summaryrefslogtreecommitdiffstats
path: root/completions/truncate
diff options
context:
space:
mode:
Diffstat (limited to 'completions/truncate')
-rw-r--r--completions/truncate32
1 files changed, 32 insertions, 0 deletions
diff --git a/completions/truncate b/completions/truncate
new file mode 100644
index 0000000..94534a2
--- /dev/null
+++ b/completions/truncate
@@ -0,0 +1,32 @@
+# truncate(1) completion -*- shell-script -*-
+
+_comp_cmd_truncate()
+{
+ local cur prev words cword was_split comp_args
+ _comp_initialize -s -- "$@" || return
+
+ local noargopts='!(-*|*[sr]*)'
+ # shellcheck disable=SC2254
+ case $prev in
+ -${noargopts}s | --size | --help | --version)
+ return
+ ;;
+ -${noargopts}r | --reference)
+ _comp_compgen_filedir
+ return
+ ;;
+ esac
+
+ [[ $was_split ]] && return
+
+ if [[ $cur == -* ]]; then
+ _comp_compgen_help
+ [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
+ return
+ fi
+
+ _comp_compgen_filedir
+} &&
+ complete -F _comp_cmd_truncate truncate
+
+# ex: filetype=sh