Metadata-Version: 2.1
Name: decree-tree
Version: 0.2.0
Summary: A minimal way to create nested argparse-based subcommands in scripts.
Home-page: https://gitlab.com/elasmocalc/decree-tree
License: Apache-2.0
Keywords: command,cli
Author: Jared Ahern
Author-email: jared.ahern.dev@gmail.com
Maintainer: Jared Ahern
Maintainer-email: jared.ahern.dev@gmail.com
Requires-Python: >=3.10,<4
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Shells
Classifier: Typing :: Typed
Requires-Dist: typing-extensions (>=4.6.0)
Project-URL: Documentation, https://elasmocalc.net/decree-tree
Project-URL: Repository, https://gitlab.com/elasmocalc/decree-tree
Project-URL: issues, https://gitlab.com/elasmocalc/decree-tree/issues
Project-URL: pypi, https://pypi.org/project/decree-tree/
Description-Content-Type: text/markdown

# decree-tree

The `decree-tree` package provides a lightweight means for defining
nested command-line interfaces, using standard `argparse`-based
parsing wrapped in a flexible class.

## Installation

To install ``decree-tree`` from PyPI via pip, run this shell command
with the proper Python environment active:

```shell
pip install decree-tree
```

If you are using a different package manager, such as Poetry,
use its appropriate installation command for the ``decree-tree``
package on PyPI.

## Usage

To create a command tree, subclass `decree_tree.DecreeTree` create
new commands, then assemble their instances appropriately. For
example, consider this file `command.py`:

```python
from decree_tree import DecreeTree

class Root(DecreeTree):
    def add_arguments(self, parser):
        super().add_arguments(parser)
        parser.add_argument('-v', '--value')

class Echo(DecreeTree):
    def execute(self):
        super().execute()
        print(self.options.value)

class Double(DecreeTree):
    def execute(self):
        super().execute()
        print(self.options.value, self.options.value)

root = Root()
root.add(Echo)
root.add(Double)

if __name__ == '__main__':
    root.run()
```

Invoking script above yields results like the following:

```shell
$ python command.py double -v bark
bark bark
```

This script can be called in many other ways, including
displaying autogenerated help. The behavior is very customizable.

## Documentation

See the full documentation [here](https://elasmocalc.net/decree-tree).

## Status

This package is relatively stable, and has had an initial release, but
is still under initial development.

To contribute, create an issue or submit an MR!

