I'm writing a Java program to print pointer tables, and the parameters keep piling up. What's the cut-off point for too many parameters - when do you move them all to a config file?
Also is there a *nix standard (or best practices) anywhere for formatting parameters for CLI apps?
Config file or parameters, plus parameter standards
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
Config file or parameters, plus parameter standards
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Config file or parameters, plus parameter standards
There's not really a cut-off point. There are plenty of CLI programs that have more parameters then you can dream up. Like curl for example (the manpage online https://curl.haxx.se/docs/manpage.html).0x2620 wrote:What's the cut-off point for too many parameters - when do you move them all to a config file?
Probably better to approach this the other way round: which parameters would a user set once and use unchanged each time they run the program, and which parameters are users likely to need/want to set to something specific each time they run the program? Consider the use of your parameters. If you do go with a config file a nice parameter to add is to use a different from default config file. So users can easily have two or more config files for particular uses.
Not really. For single letter (short) parameters use single dash. For longer than single letter (long) parameters use double dashes. Single letter parameters without (optional) arguments one would expect to be able to combine. Like if you have a -l (list) and -v (verbose) parameter, -lv should do both. Long parameters for these would for example be --list and --verbose. Good idea to have -h / --help both to show a summary of command line arguments.0x2620 wrote:Also is there a *nix standard (or best practices) anywhere for formatting parameters for CLI apps?