Parser for command line options in Java / C / C ++ / Python / shell

I am looking for a library to analyze command line options that will work the same in Java, C / C ++, Python, and (preferably) the shell. By "identical" I mean (1) have exactly the same rules for analyzing parameters in all three languages, (2) use the same configuration files or have a similar API to specify parameters, (3) have similar APIs to access parameter values.

I have always used getopt in C and Apache CLI in Java, but it would be nice to use the same specification for parameters in several languages.

+4
source share
1 answer

getopt can also be used in Python and shell. Python has an argparse module, which is much easier (especially for more complex argument parsing), but if you want consistency in all these languages, I don't know a better option than getopt. If Java does not have a getopt implementation, you can write it yourself without much effort.

+1
source

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


All Articles