From 309e85b940b9415c37e97eac877793ba9ea9827e Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sat, 15 Sep 2018 03:42:38 +0700 Subject: cmd/beku: fix parsing multiple subcommand on Sync Sync operation should accept both update and no dependency options in one line as in "-Sud". --- CHANGELOG.md | 4 ++++ cmd/beku/command.go | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdfa590..cd15baf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ ## Bug Fixes +- cmd/beku: fix parsing multiple subcommand on Sync + Sync operation should accept both update and no dependency options in one + line as in "-Sud". + - Scan: Update package version only if current and new package both are tag - env: fix get package from database that return first match by prefix diff --git a/cmd/beku/command.go b/cmd/beku/command.go index aba4453..fc4d816 100644 --- a/cmd/beku/command.go +++ b/cmd/beku/command.go @@ -143,15 +143,20 @@ func (cmd *command) parseSyncFlags(arg string) (operation, error) { return opNone, nil } - switch arg[0] { - case 'u': - return opUpdate, nil - case 'd': - cmd.noDeps = true - return opNone, nil + var op operation + + for _, c := range arg { + switch c { + case 'u': + op |= opUpdate + case 'd': + cmd.noDeps = true + default: + return opNone, errInvalidOptions + } } - return opNone, errInvalidOptions + return op, nil } func (cmd *command) parseRemoveFlags(arg string) (operation, error) { -- cgit v1.3