Closed Jean-Daniel closed 6 months ago
Thanks for the report, @Jean-Daniel! At this point, I think this needs to be treated as a documentation error, given that the behavior you've documented here has existed for some time, and is needed to support pass-through situations, where a command needs to capture the remainder of an input, regardless of what's there.
The
postTerminator
documentation stats:But in reality, that step is performed before parsing
Arguments
, but after parsingOptions
.I have the following code:
I'm trying to parse the following command line:
mytool --ssh-args -c -p 2023 -O -f "some file" -- echo "Hello World"
and get
sshArgs = [ "-c", "-p", "2023", "-O", "-f", "some file"]
andremoteCommand = [ "echo", "Hello World" ]
If the documentation was accurate,
remoteCommand
should be performed first and captureecho "Hello World"
.So, this is either the expected behavior, and the documentation requires some clarification, or the documentation is right, and
postTerminator
parsing is broken.ArgumentParser version:
1.23
Swift version: swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)
Checklist
main
branch of this packageSteps to Reproduce
Expected behavior
sshArgs contains arguments before the terminator, and remoteCommands the arguments after the terminator.
Actual behavior
sshArgs contains everything, including the terminator.