pundler icon indicating copy to clipboard operation
pundler copied to clipboard

Improve the command cli interface

Open signalpillar opened this issue 7 years ago • 3 comments

Problem

The project avoids installing own dependencies so external library needs to be vendored or idea of having own small impl. should be improved.

Current implementation shows the right direction but has lack of argument declaration/validation and thus documentation generation.

Solution

Suggest an own argparser wrapper that leverages idea of using the subparsers and also allows using the decorators to mark the functions as commands.

Other changes

  • Update CircleCI configuration to use v2 - https://circleci.com/blog/sunsetting-1-0/
  • pundleapp is the new package.
  • removed some unused dependencies

Testing

The existing tests pass.

signalpillar avatar Oct 20 '18 10:10 signalpillar

It is WIP. I think this is the direction where you want to go and it is improving the existing state. What do you think?

I am going to add the tests for the new module, so far.

signalpillar avatar Oct 20 '18 11:10 signalpillar

The tests are still running using CircleCi v1 that is disabled :(

signalpillar avatar Oct 20 '18 11:10 signalpillar

This is how help looks like for one of the commands that have description in the command.

usage: pundle run [-h] script [args [args ...]]

Execute given script.

    Examples:

    | pundle run test.py -- 1 --help

positional arguments:
  script
  args

optional arguments:
  -h, --help  show this help message and exit

The bundle command help

➭ ./pundle --help
usage: pundle [-h]
              {install,upgrade,fixate,exec,entry_points,edit,info,console,run,module,env,linkall,show_requirements}
              ...

optional arguments:
  -h, --help            show this help message and exit

subcommands:
  valid subcommands

  {install,upgrade,fixate,exec,entry_points,edit,info,console,run,module,env,linkall,show_requirements}
    install
    upgrade             Upgrade all the required packages or a single package
                        if specified
    fixate              Put activation code to usercustomize.py for the user
    exec                Execute setuptools entry
    entry_points        List available setuptools entries
    edit                Print directory path to the package
    info                Print info about pundle state
    console             Start python interpreter (ipython|bpython|ptpython)
                        with activated pundle environment
    run                 Execute given script
    module              Execute module like `python -m`
    env                 Execute any command in the environment
    linkall             Link all packages to `.pundle_local` dir
    show_requirements   Show detailed requirements info

signalpillar avatar Oct 20 '18 12:10 signalpillar