Skip to main content

Human friendly CLI builder

Project description

Human friendly CLI builder.

Installation

pip install manage.py

Quickstart

cat manage.py

from manager import Manager

manager = Manager()

@manager.command
def echo(text, capitalyze=False):
    """print the given <name>"""
    if capitalyze:
        text = text.upper()
    return text

if __name__ == '__main__':
    manager.main()

manage --help:

usage: manage [<namespace>.]<command> [<args>]

positional arguments:
  command     the command to run

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

available commands:
  echo        print the given <name>

manage echo --help:

$ manage echo --help

usage: manage [-h] [--capitalyze] text

print the given <name>

positional arguments:
  text          no description

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

Managers

Managers can be used together by merging them

from third_party import manager

my_app_manager.merge(manager)

# Merge within a new namespace:
my_app_manager.merge(manager, namespace='third_party')

Commands

Commands can be organized within namespaces

@manager.command(namespace='config')
def set(key, value):
    # ...

Arguments

Argument definition can be overridden

@manager.arg('first_arg', help='this is help for first arg')
@manager.command
def my_command(first_arg):
    # ...

Environment

Environment variables can be sourced from a .env file as key=value pair.

Project details


Download files

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

Source Distribution

manage.py-0.1b5.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file manage.py-0.1b5.tar.gz.

File metadata

  • Download URL: manage.py-0.1b5.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for manage.py-0.1b5.tar.gz
Algorithm Hash digest
SHA256 f2d55cc2500d4271afaec17fb6f1c068bc050091375150ff8de0d7c88203a8a6
MD5 aa1a7b91ced52a5733c7c2168fd617f0
BLAKE2b-256 9c1577760708a012175098bb9ad9eb9a5664a42d93cc8583152b6d6f22f9fbe1

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