-
Notifications
You must be signed in to change notification settings - Fork 106
Interface
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 come in two flavors: flags, and 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 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
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 are simply strings with no spaces in them that indicate the command given to your application. This is the "commit" it git commit.
Commands can be infinitely nested, e.g. to make a command like git remote.
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.