GSTT-CSC / hazen

Quality assurance framework for Magnetic Resonance Imaging
https://github.com/GSTT-CSC/hazen
Apache License 2.0
22 stars 12 forks source link

Improve docopt CLI interface description #307

Closed pcw24601 closed 1 year ago

pcw24601 commented 1 year ago

The CLI interface description in the docstring in ./hazenlib/__init.py__ does not conform to the docopt specification. The arguments dict returned by docopt(__doc__) contains keys for the tasks (which are not used), in addition to having the task stored under the <task> key. Furthermore, it contains an Options: key.

The __doc__ string should be re-written to follow the docopt specifications (see examples and more examples). Including better usage cases would be ideal, especially for options which only apply to one task.

Example: Calling hazen relaxometry my/path creates the following arguments dict:

{'--calc_t1': False,
 '--calc_t2': False,
 '--help': False,
 '--log': None,
 '--measured_slice_width': None,
 '--output': None,
 '--plate_number': None,
 '--report': False,
 '--show_relax_fits': False,
 '--show_rois': False,
 '--show_template_fit': False,
 '--verbose': False,
 '--version': False,
 '-h': False,
 '<folder>': 'my/path',
 '<task>': 'relaxometry',
 'Options:': False,
 'acr_ghosting': False,
 'acr_uniformity': False,
 'ghosting': False,
 'relaxometry': False,
 'slice_position': False,
 'slice_width': False,
 'snr': False,
 'snr_map': False,
 'spatial_resolution': False,
 'uniformity': False}

All entries below <task> should not be present.

sophie22 commented 1 year ago

further information on docopt (and the alternative, argparse) for future reference: https://stackoverflow.com/questions/20599513/python-difference-between-docopt-and-argparse https://realpython.com/comparing-python-command-line-parsing-libraries-argparse-docopt-click/