Skip to content

CLI framework which supports both command and subcommand.

License

Notifications You must be signed in to change notification settings

tadashi-aikawa/owcli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.13
------------------------
| 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

  • uv
  • make
  • bats

Commands

Integration test

$ make test-cli

πŸ“¦ Release

https://github.com/tadashi-aikawa/owcli/actions/workflows/release.yaml?query=workflow%3ARelease

Licence

MIT

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

About

CLI framework which supports both command and subcommand.

Resources

License

Stars

Watchers

Forks

Packages

No packages published