BCDA-APS / mdaviz

Data visualization for mda
https://bcda-aps.github.io/mdaviz/
Other
3 stars 0 forks source link

125 add command line options #133

Closed rodolakis closed 1 month ago

rodolakis commented 1 month ago
prjemian commented 1 month ago
(mdaviz) prjemian@arf:~/.../BCDA-APS/mdaviz$ mdaviz -h
usage: mdaviz [-h] [--log {critical,fatal,error,warn,warning,info,debug,notset}] [-v] directory

mdaviz: Python Qt5 application to visualize mda data.

positional arguments:
  directory             Directory loaded at start up. This argument is required.

options:
  -h, --help            show this help message and exit
  --log {critical,fatal,error,warn,warning,info,debug,notset}
                        Provide logging level. Example '--log debug'. Default level: 'warning'
  -v, --version         show program's version number and exit

ERROR: You must specified the directory:
    mdaviz /path/to/mda/data

An error message is unexpected when asking for help. The argparse package can handle this situation without the extra exception handler. It uses the help text.

prjemian commented 1 month ago

This is how it should work, asking for help:

(mdaviz) prjemian@arf:~/.../BCDA-APS/mdaviz$ mdaviz -h
usage: mdaviz [-h] [--log {critical,fatal,error,warn,warning,info,debug,notset}] [-v] directory

mdaviz: Python Qt5 application to visualize mda data.

positional arguments:
  directory             Directory loaded at start up. This argument is required.

options:
  -h, --help            show this help message and exit
  --log {critical,fatal,error,warn,warning,info,debug,notset}
                        Provide logging level. Example '--log debug'. Default level: 'warning'
  -v, --version         show program's version number and exit

And then, run without the required argument (fails):

(mdaviz) prjemian@arf:~/.../BCDA-APS/mdaviz$ mdaviz 
usage: mdaviz [-h] [--log {critical,fatal,error,warn,warning,info,debug,notset}] [-v] directory
mdaviz: error: the following arguments are required: directory
rodolakis commented 1 month ago

I just found it not super clear enough like that. I wanted to show something more explicite (the error does not stand out much)

rodolakis commented 1 month ago

I had uncommented python 3.8 because the test unit was failing, took me a little bit to debug. I put it back.

It is ready now.