I am looking to maintain/parse/update the arguments to an existing application (to implement similar functionality in Java).
I want to parse:
mycommand -flagone arg1 arg2_maynot_exist_for_some_arg1 something_hard_to_match_leftover @filereference.sql arbitraryarg1 -flagone
-flagone arg1 arg2_maynot_exist_for_some_arg1
@filereference.sql arbitraryarg1 -flagone
and left over:
@... option starting with @ to the end including argument that may match a flag (or just dump from first non match ie: something_hard_to_match_leftover @filereference.sql arbitraryarg1 -flagone
just in case the rest happens to match a flag like -flagone)
 -flagone having semi fixed arity (depending on subsequent args) (but not all the way to next flag).
Looks to me like:
something_hard_to_match_leftover @filereference.sql arbitraryarg1 -flagone
will be custom enough (and cannot be avoided) jcommander would be useful for automating simpler more well defined options (and printing usage on syntax error).
Started to look at the jcommander code to get a better grasp of it.
Thank you for your time.
Turloch O'TierneyThe views expressed in this post are my own and do not necessarily reflect the views of (my employer) Oracle Corporation.
I want to use variable arity something like:
the_command -flag_arity0 something_hard_to_match_leftover @any_thing the rest even with -flag_arity0
ie @any_thing has arity 'to the end' i.e. 'the rest even with -flag_arity0'
Did not pop out at me.
(Option: I preprocess the '@' requirement and pass the rest to jcommander - and hope no flag/arity args begin with @)
Note any_thing might be anything actually a file name reference, dynamic parameter does not look good as they do not have arity
-myflag arg1 arg2_maynot_exist_for_some_arg1 something_hard_to_match_leftover
I am have just started to look at commands for semi structured arity -
1/I might be looking for subcommands which have their own arity,
2/I may be looking for a filter (that I write) that knows when it is finished (or throws a recoverable exception when 'gone too far').
awkward to get 'to next flag' in case arg equals a flag,
awkward to take the rest as something_hard_to_match_leftover will be eaten as part of the -myflag.