エラーチェック
This commit is contained in:
parent
71ea80bd4a
commit
66fdf87fc0
@ -48,6 +48,16 @@ func run(args []string, stdin io.Reader, stdout, stderr io.Writer) int {
|
||||
return 0
|
||||
}
|
||||
|
||||
// webhook URL の解決: flag > env
|
||||
webhookURL := strings.TrimSpace(opt.WebhookURL)
|
||||
if webhookURL == "" {
|
||||
webhookURL = strings.TrimSpace(os.Getenv("SLACK_WEBHOOK_URL"))
|
||||
}
|
||||
if webhookURL == "" {
|
||||
fmt.Fprintln(stderr, "Slack webhook URL is required. Set --webhook or SLACK_WEBHOOK_URL.")
|
||||
return 2
|
||||
}
|
||||
|
||||
msg, err := message(fs.Args(), stdin)
|
||||
if err != nil {
|
||||
fmt.Fprintln(stderr, "read message error:", err)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user