From cb29346a0f55acbb8f832a2e540bef23d3c56219 Mon Sep 17 00:00:00 2001 From: JaySon-Huang Date: Fri, 3 Dec 2021 10:52:17 +0800 Subject: [PATCH] Add comments Signed-off-by: JaySon-Huang --- command.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/command.go b/command.go index 1da9df6b..03a65782 100644 --- a/command.go +++ b/command.go @@ -588,7 +588,10 @@ Loop: if len(args) == 0 { break Loop } - // Only delete 'arg' when it is not starts with '-' + // When the flag 's' doesn't contain "=" and without "no option default values", but + // following with a string starts with '-', consider 's' an unknown boolean flag + // and don't delete 'arg'. + // Otherwise, consider it as '--flag arg' or '-f arg' and delete its following arg. if !strings.HasPrefix(args[0], "-") { args = args[1:] }