Skip to content

Commit 7510e3a

Browse files
committed
Extract user config validation to method
1 parent 400b286 commit 7510e3a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cmd/submit.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@ func runSubmit(cfg config.Config, flags *pflag.FlagSet, args []string) error {
109109
return nil
110110
}
111111

112+
func (ctx *submitContext) validateUserConfig() error {
113+
if ctx.usrCfg.GetString("token") == "" {
114+
return fmt.Errorf(msgWelcomePleaseConfigure, config.SettingsURL(ctx.usrCfg.GetString("apibaseurl")), BinaryName)
115+
}
116+
if ctx.usrCfg.GetString("workspace") == "" {
117+
return fmt.Errorf(msgRerunConfigure, BinaryName)
118+
}
119+
return nil
120+
}
121+
112122
func (ctx *submitContext) sanitizeArgs() error {
113123
for i, arg := range ctx.args {
114124
var err error

0 commit comments

Comments
 (0)