cleanup extra args logging / logic

This commit is contained in:
Greg T. Wallace 2024-02-02 18:35:20 -05:00
parent 3b611b06e4
commit d94a10b949
2 changed files with 3 additions and 7 deletions

View file

@ -54,13 +54,10 @@ func Start() {
exitCode = 0
app.logger.Info("\n\n", ffhelp.Command(app.cmd))
} else if errors.Is(err, ErrExtraArgs) {
// extra args (will log elsewhere, so no need to log err again)
app.logger.Info("\n\n", ffhelp.Command(app.cmd))
} else if errors.Is(err, ff.ErrDuplicateFlag) ||
errors.Is(err, ff.ErrUnknownFlag) ||
errors.Is(err, ff.ErrNoExec) {
errors.Is(err, ff.ErrNoExec) ||
errors.Is(err, ErrExtraArgs) {
// other error that suggests user needs to see help
app.logger.Error(err)
app.logger.Info("\n\n", ffhelp.Command(app.cmd))

View file

@ -15,8 +15,7 @@ const createDefaultOutFilePath = "apctool.p15"
func (app *app) cmdCreate(_ context.Context, args []string) error {
// extra args == error
if len(args) != 0 {
app.logger.Errorf("create: failed, extra args (%d) present", len(args))
return ErrExtraArgs
return fmt.Errorf("create: failed, %w (%d)", ErrExtraArgs, len(args))
}
// key must be specified