Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suggestions for implementation of a command line interface

I am redesigning a command line application and am looking for a way to make its use more intuitive. Are there any conventions for the format of parameters passed into a command line application? Or any other method that people have found useful?

like image 984
lillq Avatar asked Sep 20 '08 16:09

lillq


People also ask

What are the three most common ways to access the CLI?

Generally, you can access the CLI through a direct connection to the console port, or remotely using Telnet or SSH command. The simplest way to enter the CLI interface is to build a direct serial connection to the switch's console port, which is demonstrated below.

What can you do with a command line interface?

A command-line interface (CLI) is a text-based user interface (UI) used to run programs, manage computer files and interact with the computer. Command-line interfaces are also called command-line user interfaces, console user interfaces and character user interfaces.


1 Answers

I see a lot of Windows command line specifics, but if your program is intended for Linux, I find the GNU command line standard to be the most intuitive. Basically, it uses double hyphens for the long form of a command (e.g., --help) and a single hyphen for the short version (e.g., -h). You can also "stack" the short versions together (e.g., tar -zxvf filename) and mix 'n match long and short to your heart's content.

The GNU site also lists standard option names.

The getopt library greatly simplifies parsing these commands. If C's not your bag, Python has a similar library, as does Perl.

like image 114
yukondude Avatar answered Oct 15 '22 19:10

yukondude