Skip to main content

General-purpose command-line interface with plugins support

Project description

Multitool is general-purpose command-line interface with plugins support.

Multitool revolves around using the click.palletsprojects package to create command plugins which are dynamically loadable into the multitool command-line at runtime.

The plugins features are based off those found in the apigeecli.

The plugins manager uses Git to manage plugins that can be installed from remote Git repositories. If Git is unavailable, then the plugins commands will not be available. However, it is possible to manually install plugins by dragging them into the correct locations.

Example plugins are available for installation here: multitool-plugins.

Why does this exist?

TBD

How it works

  1. The plugins manager multitool/plugins/commands.py will clone or pull remote repositories into ~/.multitool/plugins/.

  2. The _load_all_modules_in_directory() function in multitool/__main__.py will attempt to import the functions as specified in the __init__.py file for each plugin repository found in ~/.multitool/plugins/.

  3. If the functions found are of instance type (click.core.Command, click.core.Group) then the CLI will add it to the list of available commands.

Further details are to be documented, including how to write plugins and leverage some useful CLI libraries.

Usage

Usage: multitool [OPTIONS] COMMAND [ARGS]...

  Welcome to the Multitool command-line interface!

  PyPI:   https://pypi.org/project/multitool/
  GitHub: https://github.com/mdelotavo/multitool

Options:
  -V, --version  Show the version and exit.
  -h, --help     Show this message and exit.

Commands:
  plugins  Simple plugins manager for distributing commands.

Managing plugins

The simple plugins manager uses Git to install commands from remote sources, thus you will need to have Git installed for installation to work. However, it is possible to install plugins manually by storing plugins in the correct location (to be documented).

Currently, only the commands shown below are supported. More commands will be added to improve automation and user experience.

The steps below show how to install commands from a public plugins repository located here:

Configuring

To configure remote sources for installing plugins, run:

multitool plugins configure -a

This will open a text editor so that you can specify the remote sources.

If you don’t want changes to be automatically applied, then you can drop the -a option.

When the editor opens, copy and paste the following example configuration:

[sources]
public = https://github.com/mdelotavo/multitool-plugins.git

After saving the changes, the CLI will attempt to install the plugins from the specified Git URI. Here we use the HTTPS URI but you can also use SSH if you have configured it.

You can also specify multiple sources, as long as the key (public in this case) is unique. The key will be the name of the repository on your local machine under ~/.multitool/plugins/.

If installation is successful, you should now see additional commands when you run multitool -h

Updating

If you specified the -a option when running multitool plugins configure then install will occur automatically. Otherwise you can run:

multitool plugins update

This will install and update plugins.

Pruning

If you specified the -a option when running multitool plugins configure then the removal of plugins will occur automatically. Otherwise you can run:

multitool plugins prune

Showing

To show the plugins you have configured, run:

multitool plugins show

You can also run the following commands if you specify the plugin name:

multitool plugins show -n PLUGIN_NAME --show-commit-only
multitool plugins show -n PLUGIN_NAME --show-dependencies-only

Some plugins will not load if dependencies are not installed. You can run the following command to install them. In order for this to work, the plugin needs to have the Requires key in the JSON body of the multitool-info.json file. More details coming soon.:

pip3 install $(multitool plugins show -n PLUGIN_NAME --show-dependencies-only)

Create a virtual environment

pip3 install virtualenv
virtualenv venv
source venv/bin/activate

pip3 install -e .
python3 -m multitool -V
python3 -m multitool -h   # or just `multitool -h`

pip3 install -r requirements.txt
./runtests.sh

deactivate

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

multitool-0.2.1.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

multitool-0.2.1-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file multitool-0.2.1.tar.gz.

File metadata

  • Download URL: multitool-0.2.1.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for multitool-0.2.1.tar.gz
Algorithm Hash digest
SHA256 49c2ab7f5dab38589717e51dab839740da59f673d982166cb3192dc61e7065f6
MD5 92a28de80375aaedc60412e1ecfb6973
BLAKE2b-256 b1c7afdbfc59a8b09cc465d5b1f1890b03851bab3556fff5ae24bce6300633f0

See more details on using hashes here.

Provenance

File details

Details for the file multitool-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: multitool-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for multitool-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bdb0a05ef830c538e7e35c9cfcfe2032005cb011a0177fe31f8327f2f98adb1b
MD5 2aab175c43fc1bb27cd92b45b210541e
BLAKE2b-256 b9482e7f9135748f8465d5e6eaa5d8413bc8f807f9bbb2d3da00ecb20a15a56c

See more details on using hashes here.

Provenance

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