-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Description
If you configure an option to accept a number, it seems it's impossible to pass a negative number for the value of the option since it's interpreted as a flag instead.
I'm not 100% sure what the right way to resolve this would be without making a mess of things, but I figure it's something that should at least have a workaround.
Group {
$0.command("submit", Option<Double>("nice", default: 0, flag: "n")) { niceValue in
print(niceValue)
}
}.run()
Attempts to use that flag:
$ swiftmatrix submit --nice 123
123.0
$ swiftmatrix submit --nice -123
An error occurred: Unexpected flag `-123` as a value for `--nice`
$ swiftmatrix submit --nice -0.123
An error occurred: Unexpected flag `-0.123` as a value for `--nice`
$ swiftmatrix submit --nice=-123
Unknown Arguments: --nice=-123
Options:
--nice [default: 0.0]
$ swiftmatrix submit --nice=123
Unknown Arguments: --nice=123
Options:
--nice [default: 0.0]
Metadata
Metadata
Assignees
Labels
No labels