argshell
Integrates the argparse and cmd modules to create custom shells with argparse functionality.
Installation
Install with:
pip install argshell
Usage
Custom shells are created by subclassing the ArgShell class and adding functions of the form do_*(), just like the cmd.Cmd class.
The ArgShell class contains a rich.console.Console object that can be used to print renderables.
In terminal:
Rather than being limited to input strings, you can use argparse style parsers for shell commands.
Create a function that instantiates an ArgShellParser instance, adds arguments, and then returns the ArgShellParser object.
Then you can can decorate do_* functions using with_parser() to pass a Namespace object instead of a string.
In terminal:
The with_parser function also accepts an optional list of functions that accept and return an argshell.Namespace object.
These functions will be executed in order after the parser function parses the arguments.
In terminal:
When using your shell, entering help command will, in addition to the command's doc string,
print the help message of the parser that decorates it, if it is decorated.
The capture command can be used to save an svg of another command's output by prepending to a command.
(NOTE: This only works for output printed with ArgShell's console member mentioned earlier.)
The font size is proportional to your terminal width when using the command and any text your terminal wraps will be truncated in the svg.
The following would create a file called add.svg in your current directory:
The saved svg:
There's also a "hidden" command for generating documentation called shell_docs.
Executing that command for MyShell:
Metadata
Release files for argshell 1.6.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 |
|---|---|---|---|---|
| argshell-1.6.6.tar.gz | 8.7 kB | Without provenance | Details for argshell-1.6.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| argshell-1.6.6-py3-none-any.whl | Python 3 | none | any | Details for argshell-1.6.6-py3-none-any.whl |
Total release size: 18.1 kB
Release files / argshell-1.6.6.tar.gz
| Download URL | argshell-1.6.6.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
126bbbee654fb3b28aab9ae1327e1728d814331da814c683fcb7037f013db7fe
|
|
BLAKE2b-256 checksum How to use checksums |
464c8cb718c89696b92b5365334edd400a6afea83bccf4ba5f172f6ab26362e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0
|
Release files / argshell-1.6.6-py3-none-any.whl
| Download URL | argshell-1.6.6-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0c45f2ad59aeefe56f4443c71e2bb846e4ffe5dccc92acedcf9dcdbc43a864b0
|
|
BLAKE2b-256 checksum How to use checksums |
becebb0483b74e929c92a399f96937275a3854b9d2ab2ab7024c71789ea35902
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0
|
Security for argshell 1.6.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.