Skip to content

Commit 47af482

Browse files
committed
feat(sops): add 3rd party fallback completion loader
https://github.com/getsops/sops
1 parent b9c8bdf commit 47af482

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

completions/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ bashcomp_DATA = 2to3 \
401401
smartctl \
402402
smbclient \
403403
snownews \
404+
_sops \
404405
sqlite3 \
405406
ss \
406407
ssh \

completions/_sops

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# 3rd party completion loader for commands using -*- shell-script -*-
2+
# version 1 of the https://cli.urfave.org library.
3+
#
4+
# This serves as a fallback in case the completion is not installed otherwise.
5+
6+
# https://github.com/urfave/cli/blob/v1-maint/docs/v1/manual.md#bash-completion
7+
# https://github.com/urfave/cli/blob/v1-maint/autocomplete/bash_autocomplete
8+
_comp_cmd__urfave_cli_v1()
9+
{
10+
local cur prev words cword comp_args
11+
_comp_initialize -- "$@" || return
12+
13+
local compcmd=("${words[@]:0:cword}")
14+
if [[ $cur == -* ]]; then
15+
compcmd+=("$cur")
16+
fi
17+
compcmd+=(--generate-bash-completion)
18+
19+
_comp_compgen_split -- "$("${compcmd[@]}" 2>/dev/null)"
20+
} &&
21+
complete -o bashdefault -o default -o nospace \
22+
-F _comp_cmd__urfave_cli_v1 "$1"
23+
24+
# ex: filetype=sh

test/fallback/completions/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ EXTRA_DIST = \
3838
runuser \
3939
rustup \
4040
slackpkg \
41+
sops \
4142
su \
4243
svn \
4344
svnadmin \

test/fallback/completions/sops

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../completions/_sops

0 commit comments

Comments
 (0)