Can CmdArgs have flags outside submode?

I know that if there is a common flag among all the sub-modes, it will be indicated in the "General flags" section, but this flag should still appear after the mode constructor. Sometimes there are flags associated with the program, and not separate modes, so they must be indicated before the mode material (or even after). For example, my program can process tasks in parallel, regardless of the mode in which it works. The number of parallel processes is specified by the "-n" flag, so the command line should have something like:

myprogram -n 4 MODE1 [flags/args-for-MODE1] 

Can this be done in CmdArgs? Thanks

+4
source share
1 answer

This is not currently possible, but there is a ticket to add it to CmdArgs: http://code.google.com/p/ndmitchell/issues/detail?id=457

This can be a bit more complicated, because if you have MODE1 that accepts -n with the required argument and MODE2 that accepts -n with no argument, then this means the following:

  myprogram -n MODE2 MODE1 

It can be MODE1 and -n mode with MODE2 value, or it can be MODE2 mode with the -n flag and MODE1 argument. I am sure that I will understand that when selling a ticket.

+2
source

Source: https://habr.com/ru/post/1439632/


All Articles