Autogenerate Completions for CLI tools built with cement
This package generates Fig completions for CLI tools built on Cement.
Installation
Install the integration as a dependency using pip:
pip install cement_complete_fig
Usage
Choose one of the methods below to add the generate-fig-spec
subcommand to the top level of your CLI tool.
Method 1: Load as a Cement extension
This package provides a Cement
extension
for convenience called 'cement_complete_fig.ext.ext_complete_fig'
which can be loaded in any of the ways cited in the linked documentation.
Repeated here for convenience you can do one of the following:
- Add the extension to the
Metaof yourAppobject:
from cement import App
class MyApp(App):
class Meta:
label = 'myapp'
extensions = [
...,
'cement_complete_fig.ext.ext_complete_fig'
]
- Manually load the extension before running your app:
from cement import App
with App('myapp') as app:
app.ext.load_extension('cement_complete_fig.ext.ext_complete_fig')
app.run()
- Add the extension to your app configuration file (e.g.
.myapp.conf):
[myapp]
exensions = cement_complete_fig.ext.ext_complete_fig
Method 2: Bind the controller manually
You can also add the GenerateFigSpecController manually as a handler to your
app:
from cement import App
from cement_complete_fig import GenerateFigSpecController
class MyApp(App):
class Meta:
label = 'myapp'
handlers = [
...,
GenerateFigSpecController
]
with MyApp() as app:
app.run()
Generating the spec file
Once you've added the integration you will have new subcommand nested under your base handler. When this subcommand is invoked it will print a Fig spec.
To save your completion spec skeleton to a file, run the following:
myapp generate-fig-spec > myapp.ts
Release files for cement-complete-fig 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cement_complete_fig-1.0.0.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cement_complete_fig-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.4 kB
Release files / cement_complete_fig-1.0.0.tar.gz
| Download URL | cement_complete_fig-1.0.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d17c9f61e1e38fda58c591cb59184d79a11c3d573c0a43bde0ee0f1fb2001c25
|
|
BLAKE2b-256 checksum How to use checksums |
f4c63987d7328e7a4610032ea7e784a056e2f476a96ed4601180938229494388
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.10
|
Release files / cement_complete_fig-1.0.0-py3-none-any.whl
| Download URL | cement_complete_fig-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4dc0e096d560896c028ddc3fd8cecba35b0719e66d63fdc4ad86adb3138a79d3
|
|
BLAKE2b-256 checksum How to use checksums |
4404de660c226ea796ee2724f57b4cf2a26babeb55c6ae6c6c88ac9dcf929f39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.10
|