roocs / dachar

BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

Adapt dachar command-line to new structure #23

Closed agstephens closed 4 years ago

agstephens commented 4 years ago

Description

The new cookie-cutter package for dachar will require some thought and moving code around to realise the required command-line interface. I think these might be the required stages:

  1. Move cli.py to dachar/.
  2. Edit setup.py to set the entry point to: dachar=dachar.cli:main
  3. Set up that dachar/cli.py:main() function so that it checks the sub-command (i.e. the first component of the command-line after dachar) before calling other functions in dachar/cli.py.
  4. Those other functions can be:
    • scan(...)
    • analyse(...)
    • write_fixes(...)
  5. Each of those functions should contain only the part of the code that relates to parsing the command-line arguments before actually doing something with them. So, for example, for the scan sub-command, the cli contents should be the parts of dachar/scan/scan.py: _get_arg_parser() and parse_args.
  6. Since this will involve moving content into the dachar/cli.py module from the other modules you will probably need to modify the names of those functions to make them specific to each sub-command.

The key issue here is to separate out the argument-parsing components (which live in dachar/cli.py) from the actual functionality (which live in sub-packages such as scan, analyse etc).