Added comments and trimmed codes
diff --git a/parser_private.go b/parser_private.go
index f361aec..a64b679 100644
--- a/parser_private.go
+++ b/parser_private.go
@@ -170,6 +170,8 @@
arg = *argument
} else {
arg = s.pop()
+ // Accept any single character arguments including '-'.
+ // '-' is the special file name for the standard input or the standard output in many cases.
if len(arg) > 1 && argumentIsOption(arg) {
return newErrorf(ErrExpectedArgument, "expected argument for flag `%s', but got option `%s'", option, arg)
}
diff --git a/parser_test.go b/parser_test.go
index 9b5d8f7..3026b33 100644
--- a/parser_test.go
+++ b/parser_test.go
@@ -334,13 +334,12 @@
errType: ErrExpectedArgument,
errMsg: "expected argument for flag `--string-slice', but got option `--'",
},
-
{
// quoted and appended option should be accepted as argument (even if it looks like an option)
args: []string{"--string-slice", "foobar", "--string-slice=\"--other-option\""},
},
{
- //Accept any single character arguments including '-'
+ // Accept any single character arguments including '-'
args: []string{"--string-slice", "-"},
},
}