|
|
|
|
|
by KolenCh
692 days ago
|
|
Defopt generates cli from function interface: https://defopt.readthedocs.io/en/stable/features.html The alternative is either you maintain two interfaces with boilerplate, or write a cli only if that’s the first priority. Similar solutions exist, like fire. But fire’s cli is like an afterthought, in the sense it gives people a way to run things in command line where they already know how to run it from Python. |
|
I wrote a spec: https://gitlab.com/accidentallythecable-public/argstruct-spe...
And additionally, a library to build cli args and flags as well as api data from the same structure: https://gitlab.com/accidentallythecable-public/python-module...
This allows you to build an argstruct file specifying commands, ars, descriptions, etc. You can then run an arbitrary callback against the commands, or use argparser for commandline