Search code examples
configurationcommand-lineparameters

Command line parameters or configuration file?


I'm developing a tool that will perform several types of analysis, and each analysis can have different levels of thoroughness. This app will have a fair amount of options to be given before it starts. I started implementing this using a configuration file, since the number of types of analysis specified were little. As the number of options implemented grew, I created more configuration files. Then, I started mixing some command line parameters since some of the options could only be flags. Now, I've mixed a bunch of command line parameters with configuration files and feel I need refactoring.

My question is, When and why would you use command line parameters instead of configuration files and vice versa?

Is it perhaps related to the language you use, personal preference, etc.?

EDIT: I'm developing a java app that will work in Windows and Mac. I don't have a GUI for now.


Solution

  • Command line parameters are useful for quickly overriding some parameter setting from the configuration file. As well, command line parameters are useful if there are not so many parameters. For your case, I'd suggest that you export parameter presets to command line.