Skip to content

Commit

Permalink
Increase zsh autocompletion compatibilty (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjaudiomv committed May 2, 2024
1 parent d0030ef commit d497477
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v0.1.0 (May 2, 2024)
* Increase zsh autocompletion compatibilty.

## v0.0.9 (April 4, 2024)
* Fixes issue with help command shorthand flag `-h`. [#20] thanks @Masamerc

Expand Down
9 changes: 9 additions & 0 deletions scripts/_awsd_autocomplete
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash

[ "$BASH_VERSION" ] && AWSD_CMD="awsd" || AWSD_CMD="_awsd"
_awsd_completion() {
Expand All @@ -6,4 +7,12 @@ _awsd_completion() {
COMPREPLY=($(compgen -W "$suggestions" -- $cur))
return 0
}

# complete is a bash builtin, but recent versions of ZSH come with a function
# called bashcompinit that will create a complete in ZSH. If the user is in
# ZSH, load and run bashcompinit before calling the complete function.
if [[ -n ${ZSH_VERSION-} ]]; then
autoload -U +X bashcompinit && bashcompinit
fi

complete -o nospace -F _awsd_completion "${AWSD_CMD}"

0 comments on commit d497477

Please sign in to comment.