[cli-users] How to collect all non-option arguments?

Justin Huang yohuang at nvidia.com
Sun Nov 17 01:34:48 EST 2019


Hi,

Supposing we allow users to input non-option arguments in any order like this: -opt1 opt1_val non_opt1 -opt2 opt2_value non_opt2.

There are 2 option arguments: -opt1 opt1_val, -opt2 opt2_val, and 2 non-option arguments: non_opt1, non_opt2.

I did not find an API to return all these non-option positional arguments. I only found an 'end' index to return the first non-option argument position, but it does not work if non-option argument and option arguments are interleaved.

Is it mandatory to put all non-option arguments at the end of command line?

Thanks,
Justin


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------


More information about the cli-users mailing list