Optionally treat first top-level argument as an implicit terminator - #7
Optionally treat first top-level argument as an implicit terminator#7mistekko wants to merge 3 commits into
Conversation
Standard POSIX commands like `time' and `watch' treat their first non- hyphenated arguments as the name of a command and the remaining arguments as to be passed to that command. This was not possible in Adopt, but by adding another optional argument to `parse-options' this commit makes it possible.
|
Interesting, I can see the use case here. A couple of thoughts:
|
Previously this feature was accessed by passing an optional argument to adopt:parse-options and could only trigger when processing the first toplevel argument in a list; now it's accessed by a slot in the interface class, and any argument may trigger it so long as it satis- fies the predicate stored in that slot.
I've updated the code to use the predicate strategy rather than the |
Some commands,
timeandwatchfor example, treat their first non-hyphenated arguments as names of commands and their remaining arguments as to be passed to those commands. Currently this is not possible in Adopt, but this commit, by simply adding another optional argument toparse-options, makes it possible .Perhaps there is a more elegant way of doing this. This commit will force the user to pass a value for the
argumentsparameter inparse-options(and thusparse-options-or-exit) if they wish to parse options in thetime/watchstyle.