-
Notifications
You must be signed in to change notification settings - Fork 370
Support passing a negative number as an argument #31
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
Description
Imagine a command like this
import ArgumentParser
struct Absolute: ParsableCommand {
@Argument() var number: Int
func run() throws {
print(abs(number))
}
}
Absolute.main()you can run
command 5
and it works. but running
command -5
fails with Error: Missing expected argument '<number>' which makes sense.
I would have expected being able to pass the argument as "-5" but that doesn't work either.
Any advice on how to handle this?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed