Skip to main content

A command line interface package.

Project description

pre-commit Tests Linting: pylint

CLIpy

A python package that eases the creation of command line interface tools. It's a simple wrapper around the argparse module that simplifies the creation of CLI tools.

Features

  • Simplifies the creation of CLI tools.
  • Supports argparse arguments.
  • @clipy.App decorator: Adds a command-line parser with usage and description.
  • @clipy.Command decorator: Adds a command to the command-line parser.
  • @clipy.Option decorator: Adds an option to the command-line parser.

Usage

import clipy


@clipy.App(usage="mypackage <command> [options] [arg] ...", description="A CLI app")
@clipy.Option("option1", help="A global option")
@clipy.Command("command1", usage="mypackage command1 [options] [arg] ...", description="A descritpion", options=[
    clipy.Option("option2", help="Help message"),
    clipy.Option("flag", help="Help message", action="store_true")
])
@clipy.Command("command2", usage="mypackage command2 [options] [arg] ...", description="A descritpion", options=[
    clipy.Option("option3", help="Help message", required=True)
])
def main(command: clipy.CommandDefinition):
    print(f"Command: {command.name}")
    print("Options:")
    for key, value in command.options.items():
        print(f"  {key}: {value}")

if __name__ == "__main__":
    main()  # pylint: disable=missing-kwoa

Then enjoy your CLI tool:

python script.py --help
python script.py --global-option1 arg1 --global-option2 arg2
python script.py command1 --help
python script.py --global-option command1 --option1 arg1

Installation

pip install clipyx

From Github:

pip install git+https://github.com/G-Lauz/clipy.git@v0.1.0-pre0

Or clone the repository and install it manually:

git clone https://github.com/G-Lauz/clipy.git
cd clipy
pip install .

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

clipyx-0.1.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clipyx-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file clipyx-0.1.0.tar.gz.

File metadata

  • Download URL: clipyx-0.1.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for clipyx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5c26a221e8daaba0342f71826b9a7d0766d7ca02336c4af3600e36232aa98042
MD5 377f89882b90f7a801b8b5492448716d
BLAKE2b-256 00505931c46b39690cb28e6184ac65f1413b197ef736a577e31bc134e15323b5

See more details on using hashes here.

File details

Details for the file clipyx-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: clipyx-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for clipyx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e17733a73aa37d7e4fbe89809d7909d20b5d3958638ee6b289b2cab9c3b319e6
MD5 eea2cb27b109b4a6f18c3560ef333c05
BLAKE2b-256 0759b29c59ba337a209427429269ee8f97004b5d156dc285e1bf58eb375db3b0

See more details on using hashes here.

Supported by

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