Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is python alternative to thor (ruby) for command line applications? [closed]

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

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

like image 668
Skarab Avatar asked Oct 04 '22 06:10

Skarab


1 Answers

Python offers natively (via standard library) two packages to create auto-documenting interfaces for command line tools: optparse and argparse.

The docs says that optparse is deprecated and argparse replaces it, maintaining some backward compatibility where possible. Though, argparse is not so easy to use and 3rd-party libraries have been created.

Have a look at docopt and the video about it. cliff is another possibility.

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

I finally want to point out that docopt and cliff are not the Python alternative/s as you asked, but just the couple I found.

like image 169
Paolo Avatar answered Oct 07 '22 17:10

Paolo