Skip to content

Commit

Permalink
Merge pull request #19 from xconnio/bashcompletion
Browse files Browse the repository at this point in the history
add auto complete to snap package
  • Loading branch information
om26er authored Jun 29, 2024
2 parents 6c7def6 + 3bfdfc1 commit f035f68
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 @@

_xconn_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 _xconn_bash_autocomplete -o default xconn

4 changes: 4 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ confinement: strict
apps:
xconn:
command: bin/xconn
completer: bash_autocomplete.sh
plugs:
- network
- network-bind
Expand All @@ -22,3 +23,6 @@ parts:
source: .
build-snaps:
- go
override-prime: |
craftctl default
cp $CRAFT_PART_SRC/bash_autocomplete.sh $CRAFT_PRIME/

0 comments on commit f035f68

Please sign in to comment.