Skip to main content

A really simple library for interactive python CLIs.

Project description

PyCLI

PyCLI is a really simple library for interactive python CLIs. I mostly built it for personal use on side projects, but feel free to use it.

Install Instructions

To install:

pip install simplepycli

Basic API Example

The API is really simple, so here is a comprehensive example of how it works. This is also available at example.py:

from simplepycli import PyCLIApp

# The only paramater for PyCLIApp is the marker to use in front of the terminal; defaults to "> "
app = PyCLIApp("> ")

@app.command("egg", "Prints egg to the console")
def egg(params):
  print("egg")

@app.command("echotwice", "Echos the string passed in as a paramater twice")
def echotwice(params):
  for i in range(2):
    print(params)

app.run()

This outputs a terminal that behaves like this

> egg
egg
> echotwice abc
abc
abc
> help
exit : Exit the current CLI session and close the program.
help : List available commands and their help messages.
clear : Clear the current command line.
egg : Prints egg to the console
echotwice : Echos the string passed in as a paramater twice
> |

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

simplepycli-1.0.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

simplepycli-1.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file simplepycli-1.0.1.tar.gz.

File metadata

  • Download URL: simplepycli-1.0.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.0 CPython/3.8.10 Linux/5.15.0-58-generic

File hashes

Hashes for simplepycli-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1d475e4b9a53374beeba2080e2401cd16fc857ade106e667d68dfd525348c3df
MD5 f25d3fbb89ffd618da02459318703d38
BLAKE2b-256 9c7fabbfc23ac79e67755e05600a68e94371597408ee73394deb11beccb8edfc

See more details on using hashes here.

File details

Details for the file simplepycli-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: simplepycli-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.0 CPython/3.8.10 Linux/5.15.0-58-generic

File hashes

Hashes for simplepycli-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e3341394105ae834e9fb3e84d2f5bbba3d412d66b925e3581f03a4baba93db48
MD5 27bcc4437ee4fbf16c3958b06adf3342
BLAKE2b-256 b8e62b81cba21eab7d88845d9f07f10314dc58f1df66e074f6ace19c4b7cc46c

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