Skip to content

Instantly share code, notes, and snippets.

@ormaaj
Created August 6, 2015 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ormaaj/fe7c2ec28be275302d65 to your computer and use it in GitHub Desktop.
Save ormaaj/fe7c2ec28be275302d65 to your computer and use it in GitHub Desktop.
ksh completion
NAME
compgen - command completion.
SYNOPSIS
compgen [ options ] [word ...]
DESCRIPTION
Specify how arguments to each name should be completed. If the -p option is
supplied, or if no options are supplied, existing completion specifications
are printed to standard output in a way that allows them to be reused as
input. The -r option removes a completion specification for each name, or if
no names are supplied, all completion specifications.
OPTIONS
-A action action may be one of the following list of completions:
alias Equivalent to -a.
arrayvar
Array variable names.
binding
readline key binding names.
builtin
Equivalent to -b.
command
Equivalent to -c.
directory
Equivalent to -d.
disabled
Names of disabled shell builtins.
enabled
Names of enabled shell builtins.
export
Equivalent to -e.
file?Equivalent to -f.
function
Names of shell functions.
group Equivalent to -g.
helptopic
Help topics as accepted by the help builtin.
hostname
Hostnames, as taken from the file specified by the
HOSTFILE shell variable.
job Equivalent to -j.
keyword
Equivalent to -k.
running
Names of running jobs if job control is active.
service
Equivalent to -s.
setopt
Valid option names as acceptered by the shopt
builtin.
signal
Signal names.
stopped
Names of stopped jobs if job control is active.
user Equivalent to -u.
variable
Equivalent to -v.
-o option option may be one of the following list of completions:
bashdefault
perform bash default completions if there are no
matches
default
Use default filename completion of there are no
matches.
dirnames
Perform directory name completion if there are no
matches.
filenames
nospace
No space will be appended to words completed at the
end of the line.
-G globpat The filename expansion pattern globpat is expanded to
generate the possible completions.
-W wordlist The awordlist is split using the characters in IFS as
delimiters, and the resultant word is expanded. The possible
completions are the members of the resultant list which match
the word being completed.
-C command command is executed in a subshell environment, and its output
is used as the possible completions.
-D Use this completion as a default for commands that don't have
a completion specified.
-E Use this completion when for a blank line.
-s
-p
-e
-c
-i
-f
-i
-e
-d
-.
-F function The shell function function is executed in the current
environment. When it finishes the possible list of
completions are retrieved from the indexed array variable
COMPREPLY
-X pattern pattern is used to filter filename expansions. It is applied
to the list of possible completions generated by the
preceding options and arguments, and each completion matching
pattern is removed from the list. A leading ! in pattern
negates the pattern.
-P prefix prefix is prepended to each possible completion after all
other options have been applied.
-S suffix suffix is appended to each possible completion after all
other options have been applied.
-a Generate the list of alias names.
-b Generate the list of builtins.
-c Generate the list of command names.
-d Generate the list of directory names.
-e Generate the list of exported variable names.
-f Generate the list of file names.
-g Generate the list of group names.
-j Generate the list of job names if job control is active.
-k Generate the list of shell reserved words.
-s Generate the list of service names.
-u Generate the list of user names.
-v Generate the list of variable names.
EXIT STATUS
0 No errors occurred.
>0 An error occurred.
SEE ALSO
readonly(1), export(1)
IMPLEMENTATION
version (AT&T Research) 2014-04-21
author David Korn <dgkorn@gmail.com>
copyright Copyright (c) 1982-2015 AT&T Intellectual Property
license http://www.eclipse.org/org/documents/epl-v10.html
NAME
complete - command completion.
SYNOPSIS
complete [ options ] [word ...]
DESCRIPTION
Complete possible matches for word according to the options, which may be an
option accepted by complete with the exception of -p and -r, and write the
matches to standard output. When using the -F or -C options, the variables
shell variables set by the programmable completion facilities, while
available, will not have useful values.
OPTIONS
-A action action may be one of the following list of completions:
alias Equivalent to -a.
arrayvar
Array variable names.
binding
readline key binding names.
builtin
Equivalent to -b.
command
Equivalent to -c.
directory
Equivalent to -d.
disabled
Names of disabled shell builtins.
enabled
Names of enabled shell builtins.
export
Equivalent to -e.
file?Equivalent to -f.
function
Names of shell functions.
group Equivalent to -g.
helptopic
Help topics as accepted by the help builtin.
hostname
Hostnames, as taken from the file specified by the
HOSTFILE shell variable.
job Equivalent to -j.
keyword
Equivalent to -k.
running
Names of running jobs if job control is active.
service
Equivalent to -s.
setopt
Valid option names as acceptered by the shopt
builtin.
signal
Signal names.
stopped
Names of stopped jobs if job control is active.
user Equivalent to -u.
variable
Equivalent to -v.
-o option option may be one of the following list of completions:
bashdefault
perform bash default completions if there are no
matches
default
Use default filename completion of there are no
matches.
dirnames
Perform directory name completion if there are no
matches.
filenames
nospace
No space will be appended to words completed at the
end of the line.
-G globpat The filename expansion pattern globpat is expanded to
generate the possible completions.
-W wordlist The awordlist is split using the characters in IFS as
delimiters, and the resultant word is expanded. The possible
completions are the members of the resultant list which match
the word being completed.
-C command command is executed in a subshell environment, and its output
is used as the possible completions.
-D Use this completion as a default for commands that don't have
a completion specified.
-E Use this completion when for a blank line.
-s
-p
-e
-c
-i
-f
-i
-e
-d
-.
-F function The shell function function is executed in the current
environment. When it finishes the possible list of
completions are retrieved from the indexed array variable
COMPREPLY
-X pattern pattern is used to filter filename expansions. It is applied
to the list of possible completions generated by the
preceding options and arguments, and each completion matching
pattern is removed from the list. A leading ! in pattern
negates the pattern.
-P prefix prefix is prepended to each possible completion after all
other options have been applied.
-S suffix suffix is appended to each possible completion after all
other options have been applied.
-a Generate the list of alias names.
-b Generate the list of builtins.
-c Generate the list of command names.
-d Generate the list of directory names.
-e Generate the list of exported variable names.
-f Generate the list of file names.
-g Generate the list of group names.
-j Generate the list of job names if job control is active.
-k Generate the list of shell reserved words.
-s Generate the list of service names.
-u Generate the list of user names.
-v Generate the list of variable names.
-p Existing options for word are written to standard output in a
format that can be used for reinput.
-r Removes the completion specification for each word.
EXIT STATUS
0 No errors occurred.
>0 An error occurred.
SEE ALSO
readonly(1), export(1)
IMPLEMENTATION
version (AT&T Research) 2014-04-21
author David Korn <dgkorn@gmail.com>
copyright Copyright (c) 1982-2015 AT&T Intellectual Property
license http://www.eclipse.org/org/documents/epl-v10.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment