Skip to content

Commit

Permalink
add auto complete to snap package
Browse files Browse the repository at this point in the history
  • Loading branch information
om26er committed Jun 29, 2024
1 parent 4373910 commit 4544d14
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bash_autocomplete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

_wampproto_bash_autocomplete() {
local cur prev opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
opts=$( ${COMP_WORDS[0]} --completion-bash "${COMP_WORDS[@]:1:$COMP_CWORD}" )
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
}
complete -F _wampproto_bash_autocomplete -o default wampproto

4 changes: 4 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ compression: lzo
apps:
wampproto:
command: bin/wampproto
completer: bash_autocomplete.sh

parts:
wampproto:
plugin: go
source: .
build-snaps:
- go
override-prime: |
craftctl default
cp $CRAFT_PART_SRC/bash_autocomplete.sh $CRAFT_PRIME/

0 comments on commit 4544d14

Please sign in to comment.