An extension to typer that easily turns your typer app into a shell utility
Project description
typer-shell
typer-shell 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
Simply create a Typer instance and add it into the TyperCmd instance:
import typer
from typer_shell.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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
typer_cmd-0.0.1.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for typer_cmd-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfb3296d4d76b659de93782097dc29be706c70662622a0ca69186d014804bc63 |
|
MD5 | cc3bff7d8ef0afa64526548b8ce14152 |
|
BLAKE2b-256 | 310500b9322927e77b0968e9140b520090b8f3e9669c670e19871c9b7dde7a6e |