Skip to content

Commit

Permalink
Extract user config validation to method
Browse files Browse the repository at this point in the history
  • Loading branch information
jdsutherland committed Jan 2, 2019
1 parent 400b286 commit 7510e3a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ func runSubmit(cfg config.Config, flags *pflag.FlagSet, args []string) error {
return nil
}

func (ctx *submitContext) validateUserConfig() error {
if ctx.usrCfg.GetString("token") == "" {
return fmt.Errorf(msgWelcomePleaseConfigure, config.SettingsURL(ctx.usrCfg.GetString("apibaseurl")), BinaryName)
}
if ctx.usrCfg.GetString("workspace") == "" {
return fmt.Errorf(msgRerunConfigure, BinaryName)
}
return nil
}

func (ctx *submitContext) sanitizeArgs() error {
for i, arg := range ctx.args {
var err error
Expand Down

0 comments on commit 7510e3a

Please sign in to comment.