Skip to main content

This is your kommand, CLI interactive with python

Project description

Kommand!

GitHub GitHub issues

This is your kommand!, this package is used to interactively control your function in CL.

Get started

Requirement:

  • Python >= 3.6
  • colorama (just for color in command line)

How to install kommand:

python setup.py install

How to use kommand:

# this will build json templates for your command information.
python -m kommand build

after that you just have to fill your command information in your json file.

{
    "name": "myapp",
    "version": "0.1",
    "description": "kom test",
    "author": "kzulfazriawan",
    "email": "kzulfazriawan@gmail.com",
    "your_command": {
        "exec": "module_to_exec",
        "help": "help information"
    },
    "your_command2": {
        "exec": "module_to_exec2",
        "help": "help information2"
    }
}

In your script python you can add

from kommand import control

if __name__ == '__main__':
    control(json_file='your_file.json')
    # OR you can use with dictionary arguments
    control(
        name='your_project_name',
        version='0.1',
        your_command={'exec': 'your_module_exec', 'help': 'help information'},
        your_command2={'exec': 'your_module_exec2', 'help': 'help information2'},...
    )

Then start execute your script in command line:

python myscript.py

# to see help
python myscript.py help

# to execute
python myscript.py your_command your_command2
python myscript.py your_command2 your_command
python myscript.py your_command2
python myscript.py your_command

# if use parameter
python myscript.py your_command='p1,p2,...'

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

kommand-1.0.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distributions

kommand-1.0-py3.10.egg (8.2 kB view hashes)

Uploaded Source

kommand-1.0-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page