This public repository is read-only and no longer maintained.
Python package to build metadata driven command line tools (CLI) with out-of-the-box REST Swagger/OpenAPI support
- Documentation: https://metacli.readthedocs.io.
$ git clone git@github.com:sap-staging/python-metacli.git
$ cd ./python-metacli/
$ pip install .
$ metacli --help # Test Installation
-
Dynamic Plugin: Plugin another command project through configuration file and decorator
-
Dependency Management: Collect all required packages and detect conflicts & circular plugins
-
Builtin Plugin:
- Shell: add prompt to any command level, save and retrieve parameters from different levels
- project description: describe commands structure and arguments for any command
-
Logging
- Logging: logging for entire command structure
-
Templates:
- Simple Template: generate an empty command project quickly
- Complex Template: generate an command project based on a schema design in YAML or JSON file
-
Dynamic Plugin
In example folder, there are 3 independent command projects (cat, bird and dod). The goal is to set up a new command structure:
dog - |- bird |- catTo get a quick start, the plugin_commands.json and decorators are already configured. Please check the
/example/dog/plugin_commands.jsonand/example/dog/dogcli.pyfor more details.$ cd example/dog $ metacli dependency_management # install all dependencies, press enter in prompt to use current path $ pip install -r requirements.txt $ pip install --editable ./ # install new command structure $ dog --help # test new command structure $ dog bird --help $ dog cat --help $ dog shell # test built-in plugin shell $ dog schema --display # test built-in plugin schema, generate a schema.json to describe current command structure
-
Generate new command project
To generate a new command project which can be plugged in using MetaCLI.
$ cd example/ $ metacli create_project # press enter in prompt to use default path and name $ pip install --editable ./helloworld $ helloworld --help
To generate a new command project from metadata which can be plugged in using MetaCLI.
$ cd example/ $ metacli create_project --fromjson schema.json # press enter in prompt to use default path and name # or metacli create_project --fromyaml schema.yaml $ pip install --editable ./helloworld $ helloworld --help
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
There are no known issues.
This project is provided as is.
Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file.