Skip to main content

Make command-line interface scripts with ease

Project description

Cli

Cli is a Python library to help create command-line interfaces with ease.

Installation

pip install git+https://github.com/HashLDash/cli

Usage

from cli import cli

@cli("hello")
def hello():
  ''' This is a test command '''
  print("Hello, World!")

@cli("add <int:a> <int:b>")
def add(a, b):
  print(f'Adding {a} + {b} = {a+b}')

This would add two commands (and automagically a help command) that can be called like:

$ python command.py hello
Hello, World!
$ python command.py add 5 4
Adding 5 + 4 = 9
$ python command.py help
command.py help

    hello - This is a test command

You can also add shebangs, ommit the extension and link to your path to create a command for using like:

$ command hello
Hello, World!
$ command add 5 4
Adding 5 + 4 = 9

TODO

This is still in development. The following is planned:

  • Handling of keyword arguments
  • Increase supported types

Feel free to open issues for bugs and feature requests.

PRs are welcome too!

Enjoy :)

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

pattern-cli-0.0.2.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pattern_cli-0.0.2-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file pattern-cli-0.0.2.tar.gz.

File metadata

  • Download URL: pattern-cli-0.0.2.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for pattern-cli-0.0.2.tar.gz
Algorithm Hash digest
SHA256 9f625473539bc036f861db08f041d67fa5eabb5acf2917ef23f1fe498c6db99b
MD5 401786074a95f443b7106b6301655b37
BLAKE2b-256 4c5722373b5eaf109e2f86bd82a8368de160a400cea75cc56437d5c6bc1b39de

See more details on using hashes here.

File details

Details for the file pattern_cli-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pattern_cli-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for pattern_cli-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 caf5d9c8eae93acee25f71e6ce687b3fdc40446a99ca39adf91893c2a149067e
MD5 73da705c5fda5c5ec423d40c940f8b7f
BLAKE2b-256 e729f2754b50195cf021f5e76caf7b77b040a7c236b84ef8c747452e24132217

See more details on using hashes here.

Supported by

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