diff options
author | Wim <wim@42.be> | 2018-05-07 21:06:25 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2018-05-07 21:06:25 +0200 |
commit | 1605fbc012a7b1c5d94bfaaa45d2f3e588da5c97 (patch) | |
tree | cefeedc7bf82283eee0457e29ce2580d8f3958ff /vendor/github.com/matterbridge/gozulipbot/flag.go | |
parent | c6c92e273dea524f029065516b23e6058bc39b9e (diff) | |
download | matterbridge-msglm-1605fbc012a7b1c5d94bfaaa45d2f3e588da5c97.tar.gz matterbridge-msglm-1605fbc012a7b1c5d94bfaaa45d2f3e588da5c97.tar.bz2 matterbridge-msglm-1605fbc012a7b1c5d94bfaaa45d2f3e588da5c97.zip |
Add vendor matterbridge/gozulipbot
Diffstat (limited to 'vendor/github.com/matterbridge/gozulipbot/flag.go')
-rw-r--r-- | vendor/github.com/matterbridge/gozulipbot/flag.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/vendor/github.com/matterbridge/gozulipbot/flag.go b/vendor/github.com/matterbridge/gozulipbot/flag.go new file mode 100644 index 00000000..6305aac1 --- /dev/null +++ b/vendor/github.com/matterbridge/gozulipbot/flag.go @@ -0,0 +1,32 @@ +package gozulipbot + +import ( + "flag" + "fmt" + "time" +) + +func (b *Bot) GetConfigFromFlags() error { + var ( + apiKey = flag.String("apikey", "", "bot api key") + apiURL = flag.String("apiurl", "", "url of zulip server") + email = flag.String("email", "", "bot email address") + backoff = flag.Duration("backoff", 1*time.Second, "backoff base duration") + ) + flag.Parse() + + if *apiKey == "" { + return fmt.Errorf("--apikey is required") + } + if *apiURL == "" { + return fmt.Errorf("--apiurl is required") + } + if *email == "" { + return fmt.Errorf("--email is required") + } + b.APIKey = *apiKey + b.APIURL = *apiURL + b.Email = *email + b.Backoff = *backoff + return nil +} |