|
1 | | -============================ |
2 | | -Alternatives to cmd and cmd2 |
3 | | -============================ |
| 1 | +Alternatives |
| 2 | +============ |
4 | 3 |
|
5 | | -For programs that do not interact with the user in a continuous loop - |
6 | | -programs that simply accept a set of arguments from the command line, return |
7 | | -results, and do not keep the user within the program's environment - all |
8 | | -you need are sys_\ .argv (the command-line arguments) and argparse_ |
9 | | -(for parsing UNIX-style options and flags). Though some people may prefer docopt_ |
10 | | -or click_ to argparse_. |
| 4 | +For programs that do not interact with the user in a continuous loop - programs |
| 5 | +that simply accept a set of arguments from the command line, return results, and |
| 6 | +do not keep the user within the program's environment - all you need are sys_\ |
| 7 | +.argv (the command-line arguments) and argparse_ (for parsing UNIX-style options |
| 8 | +and flags). Though some people may prefer docopt_ or click_ to argparse_. |
11 | 9 |
|
12 | 10 | .. _sys: https://docs.python.org/3/library/sys.html |
13 | 11 | .. _argparse: https://docs.python.org/3/library/argparse.html |
14 | 12 | .. _docopt: https://pypi.python.org/pypi/docopt |
15 | 13 | .. _click: http://click.pocoo.org |
16 | 14 |
|
17 | 15 |
|
18 | | -The curses_ module produces applications that interact via a plaintext |
19 | | -terminal window, but are not limited to simple text input and output; |
20 | | -they can paint the screen with options that are selected from using the |
21 | | -cursor keys. However, programming a curses_-based application is not as |
22 | | -straightforward as using cmd_. |
| 16 | +The curses_ module produces applications that interact via a plaintext terminal |
| 17 | +window, but are not limited to simple text input and output; they can paint the |
| 18 | +screen with options that are selected from using the cursor keys. However, |
| 19 | +programming a curses_-based application is not as straightforward as using cmd_. |
23 | 20 |
|
24 | 21 | .. _curses: https://docs.python.org/3/library/curses.html |
25 | 22 | .. _cmd: https://docs.python.org/3/library/cmd.html |
26 | 23 |
|
27 | 24 | Several Python packages exist for building interactive command-line applications |
28 | | -approximately similar in concept to cmd_ applications. None of them |
29 | | -share ``cmd2``'s close ties to cmd_, but they may be worth investigating |
30 | | -nonetheless. Two of the most mature and full featured are: |
| 25 | +approximately similar in concept to cmd_ applications. None of them share |
| 26 | +``cmd2``'s close ties to cmd_, but they may be worth investigating nonetheless. |
| 27 | +Two of the most mature and full featured are: |
31 | 28 |
|
32 | 29 | * `Python Prompt Toolkit`_ |
33 | 30 | * Click_ |
34 | 31 |
|
35 | 32 | .. _`Python Prompt Toolkit`: https://github.com/jonathanslenders/python-prompt-toolkit |
36 | 33 |
|
37 | | -`Python Prompt Toolkit`_ is a library for building powerful interactive command lines and terminal applications in |
38 | | -Python. It provides a lot of advanced visual features like syntax highlighting, bottom bars, and the ability to |
39 | | -create fullscreen apps. |
| 34 | +`Python Prompt Toolkit`_ is a library for building powerful interactive command |
| 35 | +lines and terminal applications in Python. It provides a lot of advanced visual |
| 36 | +features like syntax highlighting, bottom bars, and the ability to create |
| 37 | +fullscreen apps. |
40 | 38 |
|
41 | | -Click_ is a Python package for creating beautiful command line interfaces in a composable way with as little code as |
42 | | -necessary. It is more geared towards command line utilities instead of command line interpreters, but it can be used |
| 39 | +Click_ is a Python package for creating beautiful command line interfaces in a |
| 40 | +composable way with as little code as necessary. It is more geared towards |
| 41 | +command line utilities instead of command line interpreters, but it can be used |
43 | 42 | for either. |
44 | 43 |
|
45 | | -Getting a working command-interpreter application based on either `Python Prompt Toolkit`_ or Click_ requires a good |
46 | | -deal more effort and boilerplate code than ``cmd2``. ``cmd2`` focuses on providing an excellent out-of-the-box experience |
47 | | -with as many useful features as possible built in for free with as little work required on the developer's part as |
48 | | -possible. We believe that ``cmd2`` provides developers the easiest way to write a command-line interpreter, while |
49 | | -allowing a good experience for end users. If you are seeking a visually richer end-user experience and don't |
50 | | -mind investing more development time, we would recommend checking out `Python Prompt Toolkit`_. |
51 | | - |
52 | | -In the future, we may investigate options for incorporating the usage of `Python Prompt Toolkit`_ and/or Click_ into |
53 | | -``cmd2`` applications. |
| 44 | +Getting a working command-interpreter application based on either `Python Prompt |
| 45 | +Toolkit`_ or Click_ requires a good deal more effort and boilerplate code than |
| 46 | +``cmd2``. ``cmd2`` focuses on providing an excellent out-of-the-box experience |
| 47 | +with as many useful features as possible built in for free with as little work |
| 48 | +required on the developer's part as possible. We believe that ``cmd2`` provides |
| 49 | +developers the easiest way to write a command-line interpreter, while allowing a |
| 50 | +good experience for end users. If you are seeking a visually richer end-user |
| 51 | +experience and don't mind investing more development time, we would recommend |
| 52 | +checking out `Python Prompt Toolkit`_. |
| 53 | + |
| 54 | +In the future, we may investigate options for incorporating the usage of `Python |
| 55 | +Prompt Toolkit`_ and/or Click_ into ``cmd2`` applications. |
0 commit comments