rcs-si / module_check

Check if environment variables within a module file are defined correctly
2 stars 0 forks source link

Command line arguments #14

Open katgit opened 6 months ago

katgit commented 6 months ago

Reetom,

Here are some further tasks for this project. The input arguments should work as follows:

  1. No argument - help message should display (I believe this is done automatically by the function we use)
  2. -h or --help - help message displayed (again I think it is done)
  3. -c module_name/version (or -c module_name). I am not sure -c is the best choice here (I would use -m) but we can discuss it later.
  4. -p path_to_module_file. I think this option should only be used together with the previous option so we would know the software name and version

More details:

--Katia

katgit commented 6 months ago

Follow-up discussion (February 26, 2024):

bu-bgregor commented 6 months ago

Command line arguments to implement:

module_check.py modulename/version ...args...

bu-bgregor commented 6 months ago

Checking the arguments with argparse...

modulename/version can be run through the mod_split function automatically by wrapping it into an Action subclass: https://docs.python.org/3/library/argparse.html#argparse.Action and then passing it to add_argument. something like this:

argParser.add_argument("module_to_test", action=mod_split.ModName, required=True)

That can be applied to the -p, --testpublish, and --publish flags too with an Action that makes sure that the path provided exists.