Inspiration on how to create a great command line interface

In the process of creating interactive interfaces, a distributed application, which today is used to run workloads, which had structures similar to batch work, and generally did not need a user interface. The application is mainly written in Perl and C and works with a combination of Unix and Windows computers, but I think this does not apply to the user interface.

The first such interface has a command line interface - currently I present something similar to the Cisco CLI Procurve switches and routers I worked with.

Like modern CLI CLIs, commands will resemble simple sentences (i.e. show vlans ports 1-4), and CLIs will have some kind of implicit state, mainly because Unix shells and cmd.exeWindows have environment variables and current directories work. In addition, I would like to implement excellent tab completion, which knows as much about the state of the application, and I want to be able to do this with as little application code as possible.

Low-level functionality (terminal I / O) seems easy to implement on top of the GNU Readline or similar libraries, but only where the real fun begins. So far I have looked at Perl modules Term::Shell as well Term::ShellUI, but I'm not sure I want to use any of them. I am still taking my own decision into account, and at the moment I am primarily looking for inspiration.

Can you recommend any application or library, regardless of the implementation language that implements a good CLI from which I can borrow ideas?

+3
source share
3 answers

You can try a look at libcli:

"Libcli Cisco- ."

http://code.google.com/p/libcli/

BTW - , GNU Lesser GPL Cisco .

+1
+2

/, zsh (zle).

+1

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


All Articles