code-base-investigator icon indicating copy to clipboard operation
code-base-investigator copied to clipboard

Help strings have inconsistent formatting

Open Pennycook opened this issue 1 year ago • 0 comments

At the time of writing, the usage string for Code Base Investigator looks like this:

usage: codebasin.py [-h] [-r DIR] [-c FILE] [-v] [-q] [-R REPORT [REPORT ...]] [-d <file.json>] [--batchmode] [-x <pattern>]

Code Base Investigator v1.1.1

optional arguments:
  -h, --help            show this help message and exit
  -r DIR, --rootdir DIR
                        Set working root directory (default .)
  -c FILE, --config FILE
                        configuration file (default: <DIR>/config.yaml)
  -v, --verbose         increase verbosity level
  -q, --quiet           decrease verbosity level
  -R REPORT [REPORT ...], --report REPORT [REPORT ...]
                        desired output reports (default: all)
  -d <file.json>, --dump <file.json>
                        dump out annotated platform/parsing tree to <file.json>
  --batchmode           Set batch mode (additional output for bulk operation.)
  -x <pattern>, --exclude <pattern>
                        Exclude files matching this pattern from the code base. May be specified multiple times.

We should adopt a consistent style and format for these options. I know that argparse is configurable, but I have limited experience with it. Ideally, I think we should aim for something closer to:

usage: codebasin.py [-h] [-r <directory>] [-c <file>] [-v] [-q] [-R <report> [<report> ...]] [-d <file>] [--batchmode] [-x <pattern>]

Code Base Investigator v1.1.1

Options:
  -h, --help
    Show this help message and exit.
    
  -r <directory>, --rootdir <directory>
    Set working root directory.
    Default: current directory.
    
  -c FILE, --config FILE
    Specify a configuration file.
    Default: config.yaml in the root directory.

  -v, --verbose
    Increase verbosity level.
    May be specified multiple times.

  -q, --quiet
    Decrease verbosity level.
    May be specified multiple times.

  -R <report> [<report> ...], --report <report> [<report> ...]
    Enable the specified output report(s).
    Default: all
   
  -d <file>, --dump <file>
    Dump an annotated platform/parsing tree to file in JSON format.
    
  --batchmode
    Enable batch mode. Prints additional output for bulk operation.

  -x <pattern>, --exclude <pattern>
    Exclude files matching this pattern from the code base.
    May be specified multiple times.

If we wanted to be really fancy we could even try and group the options based on what they do.

Pennycook avatar Feb 05 '24 21:02 Pennycook