You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a ParsableCommand instance with two positional arguments, one of which is required. Despite passing a value for the required argument, it still claims that argument is not being specified.
ArgumentParser version:main Swift version: 5.7.0.127.4
Checklist
If possible, I've reproduced the issue using the main branch of this package
import Foundation
import ArgumentParser
@mainstructExampleCommand:ParsableCommand{@Argument(help:"arg1", completion:.file(extensions:["sql"]), transform:URL.init(fileURLWithPath:))varfirstArg=URL(fileURLWithPath:"default/value.sql")@Argument(help:"arg2", completion:.file(extensions:["csv"]), transform:URL.init(fileURLWithPath:))varsecondArg@Flag(help:"Include extra information in the output.")varverbose= false
mutatingfunc run()throws{print(firstArg, secondArg)}}
Run example-command some/file.csv
Expected behavior
Prints the two arguments.
Actual behavior
Error: Missing expected argument '<second-arg>'
Help: <second-arg> arg2
Usage: example-command [<first-arg>] <second-arg> [--verbose]
See 'example-command --help' for more information.
Program ended with exit code: 64
The text was updated successfully, but these errors were encountered:
This is behaving as intended, since positional arguments are always filled in declaration order. It would be nice if we had a warning or validation error for commands with this configuration, so that you don't have to wonder what's going on.
I have a
ParsableCommand
instance with two positional arguments, one of which is required. Despite passing a value for the required argument, it still claims that argument is not being specified.ArgumentParser version:
main
Swift version: 5.7.0.127.4
Checklist
main
branch of this packageSteps to Reproduce
Run
example-command some/file.csv
Expected behavior
Prints the two arguments.
Actual behavior
The text was updated successfully, but these errors were encountered: