summaryrefslogtreecommitdiff
path: root/bash-completion
diff options
context:
space:
mode:
authorDhanuka Warusadura <csx@tuta.io>2021-03-11 15:02:16 +0530
committerDhanuka Warusadura <csx@tuta.io>2021-03-11 15:14:14 +0530
commit1998121ece2d9a07b7e819b897bb112b591102f3 (patch)
tree6bf30c7975dc305b2b3b92c59686c96d851d7eb5 /bash-completion
parenta99bae161866efbc5d3e4e2f1f3e2b2c48841131 (diff)
downloadlibsecret-1998121ece2d9a07b7e819b897bb112b591102f3.tar.gz
Add bash-completion for secret-tool
Fixes: https://gitlab.gnome.org/GNOME/libsecret/-/issues/50
Diffstat (limited to 'bash-completion')
-rw-r--r--bash-completion/meson.build10
-rw-r--r--bash-completion/secret-tool19
2 files changed, 29 insertions, 0 deletions
diff --git a/bash-completion/meson.build b/bash-completion/meson.build
new file mode 100644
index 0000000..9e10d9e
--- /dev/null
+++ b/bash-completion/meson.build
@@ -0,0 +1,10 @@
+bashcompdir = get_option('bashcompdir')
+if bashcompdir == ''
+ bashcomp = dependency('bash-completion', required: get_option(
+ 'bash_completion'))
+ if bashcomp.found()
+ bashcompdir = bashcomp.get_pkgconfig_variable('completionsdir')
+ else
+ warning('Will not install bash completion due to missing dependencies!')
+ endif
+endif
diff --git a/bash-completion/secret-tool b/bash-completion/secret-tool
new file mode 100644
index 0000000..184a39d
--- /dev/null
+++ b/bash-completion/secret-tool
@@ -0,0 +1,19 @@
+# secret-tool(8) completion
+
+_secret-tool()
+{
+ local cur prev word cword
+ _init_completion || return
+
+ if [[ $cur == -* ]]; then
+ local opts="--help --verbose -q --quiet" # not sure about the opts
+ COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
+ return
+ elif [[ $cword -eq 1 ]]; then
+ local commands='store lookup clear search'
+ COMPREPLY=( $(compgen -W "$commands" -- "$cur") )
+ fi
+} &&
+complete -F _secret-tool secret-tool
+
+# ex: filetype=sh