aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2025-12-13 09:40:31 -0500
committerMitchell Riedstra <mitch@riedstra.dev>2025-12-13 09:40:31 -0500
commit2f6e52f82c69ca5aedfbd7c73a63f8fb20bb39f6 (patch)
treec891c8e2d91d81167078c199543afa5dc515449e
parenta6da233005cef270e65bcdae9c6bbc58d5bdf0e3 (diff)
downloaddpw-2f6e52f82c69ca5aedfbd7c73a63f8fb20bb39f6.tar.gz
dpw-2f6e52f82c69ca5aedfbd7c73a63f8fb20bb39f6.tar.xz
add a note on bash completions
-rw-r--r--bash_completion19
1 files changed, 19 insertions, 0 deletions
diff --git a/bash_completion b/bash_completion
new file mode 100644
index 0000000..a1d413b
--- /dev/null
+++ b/bash_completion
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+# I don't use bash on the regular, but this seems to work and I imagine is
+# useful to many.
+_dpw_complete() {
+ local cur
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ local sub="show copy type list ls mv cp rm edit otp fnd find insert"
+
+ if [[ ${COMP_CWORD} -eq 1 ]]; then
+ COMPREPLY=($(compgen -W "${sub}" -- "${cur}"))
+ elif [[ ${COMP_CWORD} -eq 2 ]]; then
+ COMPREPLY=($(compgen -W "$(command dpw list)" -- "${cur}"))
+ else
+ COMPREPLY=($(compgen -f -- "${cur}"))
+ fi
+
+ return 0
+}
+complete -F _dpw_complete dpw