Browse Source

ENV requires config fields be exported.

master
David Haukeness 5 years ago
parent
commit
f057c9b560
No known key found for this signature in database
GPG Key ID: 54F2372DDB7F9462
  1. 10
      args.go

10
args.go

@ -17,7 +17,7 @@ func (b *bot) parseArgs(args []string) error {
flags := flag.NewFlagSet(args[0], flag.ExitOnError) flags := flag.NewFlagSet(args[0], flag.ExitOnError)
cliConfig := botConfig{} cliConfig := botConfig{}
flags.BoolVar(&cliConfig.Debug, "debug", false, "enables command debugging to stdout") flags.BoolVar(&cliConfig.Debug, "debug", false, "enables command debugging to stdout")
flags.StringVar(&cliConfig.logConvIDStr, "log-convid", "", "sets the keybase chat1.ConvIDStr to log to for feedback") flags.StringVar(&cliConfig.LogConvIDStr, "log-convid", "", "sets the keybase chat1.ConvIDStr to log to for feedback")
if err := flags.Parse(args[1:]); err != nil { if err := flags.Parse(args[1:]); err != nil {
return err return err
} }
@ -27,15 +27,15 @@ func (b *bot) parseArgs(args []string) error {
if cliConfig.Debug == true { if cliConfig.Debug == true {
b.config.Debug = true b.config.Debug = true
} }
if cliConfig.logConvIDStr != "" { if cliConfig.LogConvIDStr != "" {
b.config.logConvIDStr = cliConfig.logConvIDStr b.config.LogConvIDStr = cliConfig.LogConvIDStr
} }
} }
// then print the running options // then print the running options
b.debug("Debug Enabled") b.debug("Debug Enabled")
if b.config.logConvIDStr != "" { if b.config.LogConvIDStr != "" {
b.debug("Logging to conversation %s", b.config.logConvIDStr) b.debug("Logging to conversation %s", b.config.LogConvIDStr)
} }
return nil return nil

Loading…
Cancel
Save