Reputation: 223
I'm writing a program where the command line usage should be something like:
mkblueprint FILE FILE FILE -o <output name> -s <string> -r <number> -p pOPT1 pOPT2 pOPT3
I'm currently using CmdLib and I can't figure out a way to handle this; a flag is required for each input(so I can't just have FILEs sitting alone) and there doesn't appear to be a way to pass multiple arguments to a flag, as with -p
. These are extremely common in command line programs so I figure I'm just misunderstanding the documentation, but it's not mentioned in any command line library I look at for Haskell.
Upvotes: 1
Views: 1097
Reputation: 223
After some more work with CmdLib I was able to handle the bare FILE input via the Extra
tag and then checking that each string is a valid file, which seems to be the standard way to handle it despite the name. -p pOPT1 pOPT2 pOPT3
is apparently not allowed under the POSIX standard, which is why I'm not finding libraries that will do it.
Upvotes: 1
Reputation: 152707
You might consider the GetOpt
bindings that come with base
. They're not as sexy as some of the more modern alternatives, but they support bare arguments and final options well.
Upvotes: 0