mirror of
https://github.com/gregtwallace/apc-p15-tool.git
synced 2025-01-22 08:14:08 +00:00
cleanup extra args logging / logic
This commit is contained in:
parent
3b611b06e4
commit
d94a10b949
2 changed files with 3 additions and 7 deletions
|
@ -54,13 +54,10 @@ func Start() {
|
||||||
exitCode = 0
|
exitCode = 0
|
||||||
app.logger.Info("\n\n", ffhelp.Command(app.cmd))
|
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) ||
|
} else if errors.Is(err, ff.ErrDuplicateFlag) ||
|
||||||
errors.Is(err, ff.ErrUnknownFlag) ||
|
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
|
// other error that suggests user needs to see help
|
||||||
app.logger.Error(err)
|
app.logger.Error(err)
|
||||||
app.logger.Info("\n\n", ffhelp.Command(app.cmd))
|
app.logger.Info("\n\n", ffhelp.Command(app.cmd))
|
||||||
|
|
|
@ -15,8 +15,7 @@ const createDefaultOutFilePath = "apctool.p15"
|
||||||
func (app *app) cmdCreate(_ context.Context, args []string) error {
|
func (app *app) cmdCreate(_ context.Context, args []string) error {
|
||||||
// extra args == error
|
// extra args == error
|
||||||
if len(args) != 0 {
|
if len(args) != 0 {
|
||||||
app.logger.Errorf("create: failed, extra args (%d) present", len(args))
|
return fmt.Errorf("create: failed, %w (%d)", ErrExtraArgs, len(args))
|
||||||
return ErrExtraArgs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// key must be specified
|
// key must be specified
|
||||||
|
|
Loading…
Reference in a new issue