DNXLabs / one-cli

CLI to manage all stacks from DNX.
https://cli.dnx.one
Apache License 2.0
7 stars 0 forks source link

Plugin System #39

Closed arthurbdiniz closed 4 years ago

arthurbdiniz commented 4 years ago

To give better support for customization inside the CLI we created a plugin system that you can extend code, creating new commands and groups and even modify the existing ones.

All plugins need to be created inside ~/.one/plugins/*

Folder Structure

└── plugins
    ├── __init__.py (empty file)
    └── my_plugin.py

Plugin Example

~/.one/plugins/my_plugin.py

import click
from one.one import cli

def __init__():
    cli.add_command(my_plugin)

@click.command(name='my_plugin', help='My plugin command')
def my_plugin():
    print('It works!')

Running

$ one my_plugin
It works!