Skip to main content

An extension to typer that easily turns your typer app into a shell utility

Project description

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

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

typer_cmd-0.0.2.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

typer_cmd-0.0.2-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page