Skip to main content

A Python library for dynamically building CLI tools from YAML configurations.

Project description

Dynamic CLI Builder

Dynamic CLI Builder is a tool to help you create command-line interfaces (CLI) dynamically with ease.

Features

  • Easy to use
  • Highly customizable
  • Supports multiple command structures

Installation

To install Dynamic CLI Builder, use the following command:

pip install dynamic-cli-builder

Usage

Here is a simple example to get you started:

Create Actions

Actions are basically function to be executed base on command.
For instance actions.py

def say_hello(name: str):
    print(f"Hello, {name}!")

# Action Registry
ACTIONS = {
    "say_hello": say_hello,
}

you can have multiple function registered

Create yaml config

config.yaml

description: "Dynamic CLI Builder Example"
commands:
  - name: hello
    description: "Say Hello..."
    args:
      - name: name
        type: str
        help: "Name of the user."
    action: greet_user

Main file main.py

To bind this all together

from dynamic_cli_builder import run_builder
from actions import ACTIONS

run_builder('config.yaml', ACTIONS)

CLI Command

Global Help
python3 <name_of_main_file> -h

For Instance:

python3 main.py -h

command specific help

 python3 <name_of_main_file> <name_of_command> -h

For Instance:

python3 main.py say_hello -h

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

dynamic_cli_builder-0.1.6.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

dynamic_cli_builder-0.1.6-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file dynamic_cli_builder-0.1.6.tar.gz.

File metadata

  • Download URL: dynamic_cli_builder-0.1.6.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for dynamic_cli_builder-0.1.6.tar.gz
Algorithm Hash digest
SHA256 70c3a3e34c0589468aa22f7302eefbd9077ffcc8a1673f633b1c3446b31dec8e
MD5 ca6cb5d9c6d799aaff4edce5b991c5f4
BLAKE2b-256 739260db058c350225f776297aadc7146fd24ac0e4fc78e367069766d3b37b24

See more details on using hashes here.

File details

Details for the file dynamic_cli_builder-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for dynamic_cli_builder-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4e06feb342e62d73a6e7cc46267ce51db16f160845907488a8bc38d52b057ecd
MD5 dee1a207c2e79f26039d15b5bf049d96
BLAKE2b-256 34554995a6281ea87effc34def31b5d647b62c4bf35ea31d8cff4fb8b3b16e1c

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