From 4544d1475c275063b67036407678d4c8ce1b35ca Mon Sep 17 00:00:00 2001 From: Omer Akram Date: Sat, 29 Jun 2024 18:19:20 +0500 Subject: [PATCH] add auto complete to snap package --- bash_autocomplete.sh | 11 +++++++++++ snap/snapcraft.yaml | 4 ++++ 2 files changed, 15 insertions(+) create mode 100644 bash_autocomplete.sh diff --git a/bash_autocomplete.sh b/bash_autocomplete.sh new file mode 100644 index 0000000..b32fa00 --- /dev/null +++ b/bash_autocomplete.sh @@ -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 + diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index ef32e49..f773e81 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -12,6 +12,7 @@ compression: lzo apps: wampproto: command: bin/wampproto + completer: bash_autocomplete.sh parts: wampproto: @@ -19,3 +20,6 @@ parts: source: . build-snaps: - go + override-prime: | + craftctl default + cp $CRAFT_PART_SRC/bash_autocomplete.sh $CRAFT_PRIME/