JGCRI / xanthos

An extensible global hydrologic framework
Other
32 stars 16 forks source link

Read first command-line argument as config file #28

Closed calebbraun closed 5 years ago

calebbraun commented 5 years ago

Running Xanthos from the command line requires the first (only) argument to be the configuration file:

python xanthos/model.py example/pm_abcd_mrtm.ini

This errors because the flag -config_file was not specified. We should assume any extra argument is the -config_file parameter.

rplzzz commented 5 years ago

If that's the intended use, then why not just drop the - in this line? https://github.com/JGCRI/xanthos/blob/44dbf9b8bd5fda6795c1cf5dff4971d59ccaacc3/xanthos/model.py#L133 That should make the configuration file a positional rather than flag-type argument.

crvernon commented 5 years ago

We could do this for the current setup, but the goal was to get users used to the behavior incase we ever extended the args.

rplzzz commented 5 years ago

I think the best practice is usually to make mandatory arguments positional, while flags are mostly optional arguments.

crvernon commented 5 years ago

Ok, that sounds reasonable.