Skip to content
Lukas Elmer edited this page Oct 13, 2015 · 5 revisions

User Interface of GLI-based Applications

GLI's whole point is to create a polished UI for your command suite application. This describes the basics of the interface that is generated by a GLI-based application.

executable global options command command specific options optional stop switch arguments

For example:

git --no-pager commit -s -m 'Some awesome changes' Rakefile lib/my_file.rb

Here, --no-pager is the global option (an option applicable to any command), commit is the command, -s and -m 'Some awesome changes' are the command specific options (options taken only by the specific command used) and Rakefile and lib/my_file.rb are the arguments.

Options

Options come in two flavors: flags, and switches

Switches

Switches are options with no arguments; they "switch" something on (or off).

Switches can be specified one at a time in either a long or short format:

> git add -i
> git add --interactive

Switches can also be combined in their short form:

> ls -l -a    
> ls -la

Flags

Flags are options that take a required argument.

Flags can be specified in long or short form, and with or without an equals:

git merge -s resolve
git merge --strategy=resolve

Stop Switch

A -- at any time stops processing and sends the rest of the argument to the command as arguments, even if they start with a - or --.

Commands

Commands are simply strings with no spaces in them that indicate the command given to your application. This is the "commit" it git commit.

Subcommands

Commands can be infinitely nested, e.g. to make a command like git remote.

Arguments

Arguments can be anything, and can be interpreted however you like, depending on the command. There is currently no way to specify a required number of arguments in GLI.

Clone this wiki locally