Skip to main content

A CLI tool

Project description

Piou

A CLI tool to build beautiful command-line interfaces with type validation.

It is as simple as

from piou import Parser, CmdArg

parser = Parser(description='A CLI tool')

parser.add_argument('-h', '--help', help='Display this help message')
parser.add_argument('-q', '--quiet', help='Do not output any message')
parser.add_argument('--verbose', help='Increase verbosity')


@parser.command(cmd='foo',
                help='Run foo command')
def foo_main(
    foo1: int = CmdArg(..., help='Foo arguments'),
    foo2: str = CmdArg('-f', '--foo2', help='Foo arguments')
):
    print('Ran foo main with ', foo1)
    print('foo2: ', foo2)


@parser.command(cmd='bar', help='Run bar command')
def bar_main():
    pass


if __name__ == '__main__':
    parser.print_help()
    parser.run()

The output will look like this:

example

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

piou-0.1.1.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

piou-0.1.1-py3-none-any.whl (6.3 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