Skip to content

phoenixr-codes/powercli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

56 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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.

About

Build powerful command-line applications in Python 🐍⚑

Topics

Resources

License

Contributing

Stars

Watchers

Forks