typer-cmd
typer-cmd is an extension to typer that easily turns your typer app into a shell utility. It is built on top of the built in python cmd module, with modifications to make it work with typer.
Usage
pip install typer-cmd
Simply create a Typer instance and add it into the TyperCmd instance:
import typer
from typer_cmd.shell import TyperCmd
app = typer.Typer()
job_app = typer.Typer()
app.add_typer(job_app, name="job")
@app.command()
def hello(name: str):
print("hello", name)
@job_app.command()
def run(name: str):
print(f'run job {name}')
@job_app.command()
def list():
print('list jobs')
if __name__ == "__main__":
cmd = TyperCmd(typer=app)
cmd.cmdloop()
or u can make a new subclass from TyperCmd and add your own necessary initializing code
Metadata
Release files for typer-cmd 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| typer_cmd-0.0.2.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| typer_cmd-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.0 kB
Release files / typer_cmd-0.0.2.tar.gz
| Download URL | typer_cmd-0.0.2.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
505e54e0d4a3366c56557f1e8ce9f26a14dffb599b93366fc742239180a1a5d6
|
|
BLAKE2b-256 checksum How to use checksums |
dc9dac21e50497f8abbc8fcec20cc312584d58582b8efa135c571da41c31874f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.9.3 CPython/3.11.5
|
Release files / typer_cmd-0.0.2-py3-none-any.whl
| Download URL | typer_cmd-0.0.2-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9db7d62b3c9bad1bd13c4c3d0a36cc1301e2e1c163d0a3df9931db585f2736c8
|
|
BLAKE2b-256 checksum How to use checksums |
10444e6976b9dc3e7b0ab8f3c1be095bffaa1ee40967415bc064eb008464911f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.9.3 CPython/3.11.5
|