Skip to main content

CLI framework which supports both command and subcommand.

Project description

owcli

pypi versions Actions Status 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> --python <python_version>

Run

$ cd <app_name>
$ pipenv install
$ pipenv run python <app_name>/main.py --help

Concrete example

$ owcli init testapp --python 3.7
------------------------
| 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
$ pipenv install
$ pipenv shell
$ python testapp/main.py --help
Usage:
  testapp <command> [<subcommand>] [<args>...]
  testapp <command> [<subcommand>] (-h | --help)
  testapp (-h | --help)
  testapp --version

Commands:
  cmd1                Command1
  cmd2                Command2

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

Subcommands:
  subcmd1                       Subcommand1
  subcmd2                       Subcommand2

$ python 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.
  
$ python testapp/main.py cmd2 subcmd1 hoge hoga hogu -f
flag: true
names:
  - hoge
  - hoga
  - hogu

For developer

Requirements

  • poetry
  • make
  • bats

Commands

Integration test

$ make test-cli

Version up

make release version=x.y.z

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.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

owcli-0.8.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file owcli-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: owcli-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.0 Windows/10

File hashes

Hashes for owcli-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a6ffcd399e2da29f9460dd78298fd4f8c9b48d5f571eb874db8bf0f23ba0b9b
MD5 5c2f870b74842f65ada92dc92691f877
BLAKE2b-256 46e0af7168bd06c87ab9f13505d1abeea93b18a39f1745f4a8acea8e240280cf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page