mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-03-16 23:00:31 +00:00
Update cheatsheets
This commit is contained in:
@@ -5,17 +5,31 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# complete
|
||||
|
||||
> Get argument autocompletion to shell commands.
|
||||
> More information: <https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion-Builtins.html#index-complete>.
|
||||
> Get and set argument autocompletion rules of shell commands in Bash.
|
||||
> The specified completions will be invoked when `<Tab>` is pressed in Bash.
|
||||
> See also: `compgen`, `compopt`.
|
||||
> More information: <https://www.gnu.org/software/bash/manual/bash.html#index-complete>.
|
||||
|
||||
- Apply a function that performs autocompletion to a command:
|
||||
- Set arguments of a command to autocomplete through a function (completion response is sent in `COMPREPLY` variable):
|
||||
|
||||
`complete -F {{function}} {{command}}`
|
||||
|
||||
- Apply a command that performs autocompletion to another command:
|
||||
- Set arguments of a command to autocomplete through another command (`$1` is the command, `$2` is the argument the cursor is on, and `$3` is the argument preceding the cursor):
|
||||
|
||||
`complete -C {{autocomplete_command}} {{command}}`
|
||||
|
||||
- Set arguments of a command to autocomplete to shell builtins:
|
||||
|
||||
`complete -b {{command}}`
|
||||
|
||||
- Apply autocompletion without appending a space to the completed word:
|
||||
|
||||
`complete -o nospace -F {{function}} {{command}}`
|
||||
|
||||
- List all loaded complete specifications:
|
||||
|
||||
`complete -p`
|
||||
|
||||
- List loaded complete specifications for a command:
|
||||
|
||||
`complete -p {{command}}`
|
||||
|
||||
Reference in New Issue
Block a user