What is the python alternative for torus (ruby) for command line applications?

What is the python alternative for Thor for creating self-documenting command line utilities?

UPDATE: Click is the closest Thor equivalent for python, see http://click.pocoo.org/

+4
source share
2 answers

Python initially offers (through the standard library) two packages for creating automatic documenting interfaces for command line tools: optparse and argparse .

The docs say optparse deprecated, and argparse replaces it while maintaining some backward compatibility. Although, argparse is not so easy to use and third-party libraries are created.

Check out the docopt and video about it. cliff is another possibility.

To write line-oriented command-line interpreters, you can find a useful Python cmd module.

Finally, I want to note that docopt and cliff are not an alternative to Python / s, as you requested, but only the pair I found.

+2
source

Not sure if this is exactly what you want, but imho is Sphinx + python docstring + argparse .

+2
source

Source: https://habr.com/ru/post/1496809/


All Articles