jsh - a Junos-style CLI library
JSH is a Junos-inspired CLI library for your Python apps. If you’ve ever logged into a Junos device, you’ll know how good the CLI is. It offers:
tab-completion, including completion of names of items in the config
help by pressing “?” at any point
completion on pressing either space, tab or enter
JSH attempts to reproduce some of these features (and others) in a Python library based on Readline, to allow you to build better quality CLIs for your apps.
Documentation
Full documentation can be found at RTD.
Installation
Install from PyPI using pip install jsh.
Basic Usage
The library takes a CLI “layout”, which is a dictionary-based tree structure describing your CLI commands. For example, a completely useless CLI with just an exit command, you would define it like this:
import jsh
layout = {
'exit': jsh.exit,
}
jsh.run(layout)
jsh.run is a shortcut for the following:
cli = jsh.JSH(layout)
while True:
try:
cli.read_and_execute()
except jsh.JSHError as err:
print err
except EOFError:
break
This creates a basic layout with a single available command (exit), passes it to an instance jsh.JSH, and starts an infinite loop, using the read_and_execute method of the JSH CLI object to interact with the user. For more control over this loop, you should write your own instead of using jsh.run.
This provides a CLI that looks like the following:
> ? Possible completions: exit > ex? Possible completions: exit > exit ? Possible completions: <[Enter]> Execute this command > exit
Metadata
Release files for jsh 0.3.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jsh-0.3.6.tar.gz | 10.0 kB | Without provenance | Details for jsh-0.3.6.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jsh-0.3.6-py3-none-any.whl | Python 3 | none | any | Details for jsh-0.3.6-py3-none-any.whl |
| jsh-0.3.6-py2-none-any.whl | Python 2 | none | any | Details for jsh-0.3.6-py2-none-any.whl |
Total release size: 26.1 kB
Release files / jsh-0.3.6.tar.gz
| Download URL | jsh-0.3.6.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f5f929fbda895f09663b23c12845720d08502e4e95bc5b7be62cb664efe9370
|
|
BLAKE2b-256 checksum How to use checksums |
9b9fe0c300dbfff397c4f2758184005f1338f76f055be1b7484b32d2056030a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / jsh-0.3.6-py3-none-any.whl
| Download URL | jsh-0.3.6-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
73e86421d409e5a30df4954ae89d5d08c8c59bb147387f86d88c9bf3689f313b
|
|
BLAKE2b-256 checksum How to use checksums |
6c909a6b47d964f0df63543c0687970cdd7afacfa0bab67c0bf9d79b247979c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / jsh-0.3.6-py2-none-any.whl
| Download URL | jsh-0.3.6-py2-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
e2b80492394362f21ffe41c66b787c35c43b9f5edc5d5afcaef667825bd010f8
|
|
BLAKE2b-256 checksum How to use checksums |
304ce384eda16643155e998c0dd9a708610679ba24f836bcbd1a557214b87304
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for jsh 0.3.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.