aboutsummaryrefslogtreecommitdiffstats
path: root/nvchecker/nvtake.bash_completion
diff options
context:
space:
mode:
Diffstat (limited to 'nvchecker/nvtake.bash_completion')
-rw-r--r--nvchecker/nvtake.bash_completion16
1 files changed, 16 insertions, 0 deletions
diff --git a/nvchecker/nvtake.bash_completion b/nvchecker/nvtake.bash_completion
new file mode 100644
index 0000000..23776c2
--- /dev/null
+++ b/nvchecker/nvtake.bash_completion
@@ -0,0 +1,16 @@
+# MIT licensed
+# Copyright (c) 2020 Felix Yan <felixonmars@archlinux.org>, et al.
+
+_nvtake() {
+ local cur _nvchecker_conf_mtime
+ _init_completion || return
+
+ _nvchecker_conf_mtime="$(stat -c %Y $HOME/.config/nvchecker/*)"
+ if [ -z "$_nvtake_completion_cache" -o "$_nvchecker_conf_mtime" != "$_nvchecker_conf_mtime_cached" ]; then
+ _nvtake_completion_cache="$(nvcmp -q)"
+ _nvchecker_conf_mtime_cached="$_nvchecker_conf_mtime"
+ fi
+
+ COMPREPLY=( $(compgen -W "$_nvtake_completion_cache" -- "$cur") )
+} &&
+ complete -F _nvtake nvtake