Skip to main content

Build powerful command-line applications in Python

Project description

PowerCLI

Build powerful command-line applications in Python 🐍⚡

Features

  • ✅ Simple API
  • ✅ Highly configurable
  • ✅ Flags, Positionals & Subcommands
  • ✅ Type Hints
  • ✅ Easy to test
  • ✅ Well documented

Installation

Poetry

poetry add powercli-python

uv

uv add powercli-python

Manual Installation

Add powercli-python as a dependency in your pyproject.toml file.

dependencies = [
  "powercli-python"
]

Overview

Highly Configurable

Commands and arguments are highly configurable yet provide good defaults to work well out of the box.

import sys
from powercli import Command

cmd = Command(
    # Windows-style flag prefixes
    prefix_short=None,
    prefix_long="/",

    # use other stream
    file=sys.stderr,
)

Object Oriented

Arguments are classes which can be instantiated dynamically and are not directly bound to a parser class.

from pathlib import Path
from powercli import Flag

cmd = Command()

flag = Flag(
    identifier="foo",
    short="f",
    values=[("PATH", Path)],
)
cmd.add_arg(flag)

# ... or use the shorthand ...

cmd.flag(
    identifier="foo",
    short="f",
    values=[("PATH", Path)]
)

Generate man pages

$ python3 -m powerdoc path/to/file.py --man
$ python3 -m powerdoc path/to/file.py --man | groff -T utf8 -man

Colored output

The built-in provided flags and commands make use of colored output respecting the user's preference.

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

powercli_python-0.2.0.tar.gz (35.4 kB view details)

Uploaded Source

Built Distribution

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

powercli_python-0.2.0-py3-none-any.whl (43.3 kB view details)

Uploaded Python 3

File details

Details for the file powercli_python-0.2.0.tar.gz.

File metadata

  • Download URL: powercli_python-0.2.0.tar.gz
  • Upload date:
  • Size: 35.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.13 Linux/6.17.3-arch2-1

File hashes

Hashes for powercli_python-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4dad1eace43f349de30e2117e1f5b1b7415e9debf2d44f402a9e0997f5c87fd5
MD5 e8571d1e8f5ed29ed05f3ebbde000fb5
BLAKE2b-256 93a5dd2c273de1f5136c31a4cf6904f17f2561369d84b1534c89dcea41f36713

See more details on using hashes here.

File details

Details for the file powercli_python-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: powercli_python-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 43.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.13 Linux/6.17.3-arch2-1

File hashes

Hashes for powercli_python-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9bf8a8ef7b4a458593207e5ceb09ce32b91f9a7537773ef4cf8f98aaf99894a
MD5 6ef3251626a3bb4aa31ddd1972c7f0b4
BLAKE2b-256 84bd825a50071e96c780d023be00588337645a4c2d1b70a57a2d1a7c36766149

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