The Command Synopsis
To understand what the actual completions for command parameters are, it is necessary to understand the command’s parameters. In particular we are interested in the following aspects:
- Is there a fixed list of words that are allowed as parameters when invoking the command, and
- are there specific types of parameters that must appear in a specific order on the command line?
A common place for such information is within manual pages, and there specifically in the first section, „SYNOPSIS“. The synopsis of a command describes a command line schema in a very condensed form, usually denoting the command itself followed by the different parameter types, where the „ellipsis symbol“ … indicates that a parameter of the specific type may be repeated, and the square brackets […] indicate that a specific portion of the command line is optional and may be omitted. For example, the synopsis of the „ls“ command could be:
ls [OPTION …] [FILE …]
In this synopsis, the following requirements about the invocation of ls are stated:
- Parameters are either „options“ or „files“,
- both may be omitted, and
- all options must precede all files.
Judging from its built-in help message and the documentation, the command pulseaudio-tcp supports the following options and non-option arguments:
- Options are of the „long option“ style and have no short counterpart.
- --help causes the program to emit a help message and then exit.
- --debug causes the program to emit additional diagnostic information.
- --nogui causes the program to fall back to terminal-based user interaction even if a display session was detected.
- It is mandatory to provide exactly one „command verb“, which can be one of the following:
- start causes the program to start the redirection.
- stop causes the program to stop a currently started redirection.
- restart is equivalent to an execution of stop followed by an execution of start.
- status causes the program to check if the redirection is currently started. If true, the program exits successfully, otherwise it exits with an error.
- setup causes the program to perform an interactive setup procedure.
It is also noteworthy that no particular order of options and command verbs is required. The „synopsis (of the invocation)“ of pulseaudio-tcp could therefore be written as:
pulseaudio-tcp [OPTION …] COMMAND_VERB [OPTION …]
- Bourne to Bourne Again Shell Forward Compatibility
- Print XDG Desktop Definition for Application
- Using sed or awk to ensure a specific last Line in a Text
- Make a Bourne Again Shell Script Log its Output to a File
- Maintaining Multi-Line „stat“ Formats using Bourne Again Shell
- Print all indented Lines following a non-indented Line
- An Introduction to Programmable Completion in Bash