summaryrefslogtreecommitdiffstats
path: root/completions/sha256sum
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:03:19 +0000
commit6c09f2a45c5541e9c207d14fc7aa21a4a0066bde (patch)
tree0221189d367bf661f6f9493c4f17a03f0dd4b7d2 /completions/sha256sum
parentReleasing progress-linux version 1:2.11-8~progress7.99u1. (diff)
downloadbash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.tar.xz
bash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.zip
Merging upstream version 1:2.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/sha256sum')
-rw-r--r--completions/sha256sum38
1 files changed, 38 insertions, 0 deletions
diff --git a/completions/sha256sum b/completions/sha256sum
new file mode 100644
index 0000000..adef1cd
--- /dev/null
+++ b/completions/sha256sum
@@ -0,0 +1,38 @@
+# bash completion for sha256(1) and friends -*- shell-script -*-
+
+_comp_cmd_sha256sum()
+{
+ local cur prev words cword was_split comp_args
+ _comp_initialize -s -- "$@" || return
+
+ case $prev in
+ -h | --help | --version)
+ return
+ ;;
+ esac
+
+ [[ $was_split ]] && return
+
+ if [[ $cur == -* ]]; then
+ _comp_complete_longopt "$@"
+ return
+ fi
+
+ local sumtype=${1##*/}
+ sumtype=${sumtype%sum}
+
+ local opt
+ for opt in "${words[@]}"; do
+ if [[ $opt == -@(c|-check) ]]; then
+ _comp_compgen_filedir "$sumtype"
+ return
+ fi
+ done
+
+ local files
+ _comp_compgen -v files filedir &&
+ _comp_compgen -- -X "*.$sumtype" -W '"${files[@]}"'
+} &&
+ complete -F _comp_cmd_sha256sum b2sum md5sum sha{,1,224,256,384,512}sum
+
+# ex: filetype=sh