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.2.1.tar.gz (7.9 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.2.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: clipyx-0.2.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for clipyx-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d5640709b2d940479fde37ddd0ec972ea4c2761739d3c26d37468f43743f4c6b
MD5 c5aa3f008ea04e7c4aa188269db38c15
BLAKE2b-256 29b93199c8b9e7bc0bc37408272321c7ec15309b504efb811c130e657ac32089

See more details on using hashes here.

Provenance

The following attestation bundles were made for clipyx-0.2.1.tar.gz:

Publisher: publish.yml on G-Lauz/clipy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: clipyx-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for clipyx-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ec2c8388ef99006e3e310f03a98c662ded76a0b91c3a9eca9a08c81aa4fd82fa
MD5 d03413e44d44b1ddb91b3273dcbe17f2
BLAKE2b-256 6f0e260a423e33509887acaeda60aaa4ed5e2b493ebca2259f466d248b7e093a

See more details on using hashes here.

Provenance

The following attestation bundles were made for clipyx-0.2.1-py3-none-any.whl:

Publisher: publish.yml on G-Lauz/clipy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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