Skip to main content

CLI framework which supports both command and subcommand.

Project description

owcli

versions pypi license

CLI framework which supports both command and subcommand based on docopt.

Install

$ pip install owcli

Quick start

Create owcli project.

$ owcli init <app_name>

Run

$ cd <app_name>
$ <app_name>/main.py --help

Concrete example

$ owcli init testapp
------------------------
| Create entries...    |
------------------------
๐Ÿ“‚ /mnt/c/Users/syoum/git/github.com/tadashi-aikawa/owcli/testapp
 โˆŸ๐Ÿ“„ Pipfile
 โˆŸ๐Ÿ“„ README.md
 โˆŸ๐Ÿ“„ setup.py
 โˆŸ๐Ÿ“‚ testapp
   โˆŸ๐Ÿ“‚ commands
     โˆŸ๐Ÿ“‚ cmd1
       โˆŸ๐Ÿ“„ main.py
       โˆŸ๐Ÿ“„ __init__.py
     โˆŸ๐Ÿ“‚ cmd2
       โˆŸ๐Ÿ“„ main.py
       โˆŸ๐Ÿ“‚ subcmd1
         โˆŸ๐Ÿ“„ main.py
         โˆŸ๐Ÿ“„ __init__.py
       โˆŸ๐Ÿ“‚ subcmd2
         โˆŸ๐Ÿ“„ main.py
         โˆŸ๐Ÿ“„ __init__.py
       โˆŸ๐Ÿ“„ __init__.py
     โˆŸ๐Ÿ“„ __init__.py
   โˆŸ๐Ÿ“„ main.py
   โˆŸ๐Ÿ“„ __init__.py

------------------------
| Next you have to ... |
------------------------
.
.

$ cd testapp
$ testapp/main.py --help
Usage:
  testapp <command> [<subcommand>] [<args>...]
  testapp <command> [<subcommand>] (-h | --help)
  testapp (-h | --help)
  testapp --version

Commands:
  cmd1                Command1
  cmd2                Command2

$ testapp/main.py cmd2 -h
Usage:
  testapp cmd2 [<subcommand>] [<args>...]
  testapp cmd2 (-h | --help)

Subcommands:
  subcmd1                       Subcommand1
  subcmd2                       Subcommand2

$ testapp/main.py cmd2 subcmd1 --help
Subcommand1

Usage:
  testapp cmd2 subcmd1 <names>... [-f|--flag]
  testapp cmd2 subcmd1 (-h | --help)

Options:
  <names>...                           Names
  -f --flag                            Flag
  -h --help                            Show this screen.

$ testapp/main.py cmd2 subcmd1 hoge hoga hogu -f
flag: true
names:
  - hoge
  - hoga
  - hogu

For developer

Requirements

  • pipenv
  • make
  • bats

Commands

Create and activate env

$ make init
$ pipenv shell

Integration test

$ make test-cli

Version up

Confirm that your branch name equals release version

$ make release

Finally, create pull request and merge to master!!

Licence

MIT

This software is released under the MIT License, see LICENSE.txt.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for owcli, version 0.4.1
Filename, size File type Python version Upload date Hashes
Filename, size owcli-0.4.1-py3-none-any.whl (12.2 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page