Is there a parsing strategy to allow a trailing argument?

I have an option that takes an array of strings, and I am using .upToNextOption to catch them all. I then use an option to get the filename to operate on, but I would prefer to use a trailing argument for the filename instead. Is there any way to do that?

Do you mean you want this kind of interface?

% my-command one two three four filename.txt

Actually more like this

program command —option a b c filename.txt

Ah, no — not that specific syntax, nor the one I posted. Your syntax can be used this way:

program command filename.txt -option a b c

...but the way you've written the command, option will always capture the file name, too. If this kind of support is important for your use case, could you please file an issue on the repository?


1 Like
Terms of Service

Privacy Policy

Cookie Policy