Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(readme): correct information #30

Merged
merged 1 commit into from
May 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ if (env.prev === '--loglevel') {

## Completion mechanism

Feel free to browse the [scripts](./scripts) directory to inspect the various
Feel free to browse the [examples](./examples) directory to inspect the various
template files used when creating a completion with `tabtab.install()`.

Here is a Bash completion snippet created by tabtab.
Expand All @@ -297,9 +297,15 @@ if type complete &>/dev/null; then
IFS=$'\n' COMPREPLY=($(COMP_CWORD="$cword" \
COMP_LINE="$COMP_LINE" \
COMP_POINT="$COMP_POINT" \
tabtab-test completion -- "${words[@]}" \
SHELL=bash \
tabtab-test completion-server -- "${words[@]}" \
2>/dev/null)) || return $?
IFS="$si"

if [ "$COMPREPLY" = "__tabtab_complete_files__" ]; then
COMPREPLY=($(compgen -f -- "$cword"))
fi

if type __ltrim_colon_completions &>/dev/null; then
__ltrim_colon_completions "${words[cword]}"
fi
Expand All @@ -311,7 +317,7 @@ fi

The system is quite simple (though hard to nail it down, thank you npm). A new
Bash function is created, which is invoked whenever `tabtab-test` is tab
completed. This function then invokes the completer `tabtab-test completion`
completed. This function then invokes the completer `tabtab-test completion-server`
with `COMP_CWORD`, `COMP_LINE` and `COMP_POINT` environment variables (which is
parsed by `tabtab.parseEnv()`).

Expand Down
Loading