summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_mv
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2020-02-14 01:58:20 +0100
committerAxel Beckert <abe@deuxchevaux.org>2020-02-14 01:58:20 +0100
commitbfc5d42735c1660263904ec5254cccf539a0a458 (patch)
tree9bbb81b4a53941427e6f9e65ae55027d9108df8c /Completion/Unix/Command/_mv
parent74561cc51b8867e43cb2937ab2edfb36e2a829bf (diff)
parent643de931640e01aa246723d2038328ef33737965 (diff)
downloadzsh-bfc5d42735c1660263904ec5254cccf539a0a458.tar.gz
zsh-bfc5d42735c1660263904ec5254cccf539a0a458.zip
Merge tag 'zsh-5.7.1-test-3' into debian
Test release: 5.7.1-test-3
Diffstat (limited to 'Completion/Unix/Command/_mv')
-rw-r--r--Completion/Unix/Command/_mv93
1 files changed, 53 insertions, 40 deletions
diff --git a/Completion/Unix/Command/_mv b/Completion/Unix/Command/_mv
index 3592efee6..84e43d47e 100644
--- a/Completion/Unix/Command/_mv
+++ b/Completion/Unix/Command/_mv
@@ -1,42 +1,55 @@
-#compdef mv gmv
+#compdef mv gmv zf_mv
-local args
-if _pick_variant gnu=GNU unix --version; then
- args=(
- '(-b --backup -n --no-clobber)--backup=[make a backup of each existing destination file]: : _values "backup type"
- {none,off}"[never make backups]"
- {numbered,t}"[make numbered backups]"
- {existing,nil}"[numbered backups, if they already exist]"
- {simple,never}"[always make simple backups]"'
- '(-b --backup -n --no-clobber)-b[make a backup of each existing destination file]'
- '(-f --force -i --interactive -n --no-clobber)'{-f,--force}"[don't prompt before overwriting]"
- '(-f --force -i --interactive -n --no-clobber)'{-i,--interactive}'[prompt before overwriting existing file]'
- '--strip-trailing-slashes[remove any trailing slashes from each source argument]'
- '(-S --suffix)'{-S+,--suffix=}'[specify the backup suffix]:backup suffix [~]'
- '(-t --target-directory)'{-t+,--target-directory=}'[move all source arguments into specified directory]:directory:_directories'
- '(-T --no-target-directory)'{-T,--no-target-directory}'[treat final argument as a normal file]'
- '(-u --update)'{-u,--update}'[move only when destination file is older or missing]'
- '(-v --verbose)'{-v,--verbose}'[show file names after they are moved]'
- '(- *)--help[display usage information]'
- '(- *)--version[display version information]'
- )
- [[ $OSTYPE = linux* ]] && args+=(
- '(-Z --context)'{-Z,--context}'[set SELinux security context of destination file to default type]'
- )
-else
- local pattern arg
- args=(
- "(-i -n)-f[don't prompt before overwriting]"
- '(-f -n)-i[prompt before overwriting existing file]'
- )
- for pattern arg in \
- '(darwin|dragonfly|freebsd)*' "(-f -i)-n[don't overwrite existing file]" \
- '(darwin|dragonfly|*bsd)*' '-v[show file names after they are moved]' \
- '(dragonfly|freebsd)*' "-h[if target is a symlink to a directory, don't follow it]"
- do
- [[ $OSTYPE = $~pattern ]] && args+=( $arg )
- done
-fi
+local args variant aopts=( -A '-*' )
-_arguments -s -S $args \
- '*:file:_files'
+_pick_variant -r variant -b zsh gnu=GNU $OSTYPE --version
+case $variant; in
+ gnu)
+ aopts=()
+ args=(
+ '(-b --backup -n --no-clobber)--backup=[make a backup of each existing destination file]: : _values "backup type"
+ {none,off}"[never make backups]"
+ {numbered,t}"[make numbered backups]"
+ {existing,nil}"[numbered backups, if they already exist]"
+ {simple,never}"[always make simple backups]"'
+ '(-b --backup -n --no-clobber)-b[make a backup of each existing destination file]'
+ '(-f --force -i --interactive -n --no-clobber)'{-f,--force}"[don't prompt before overwriting]"
+ '(-f --force -i --interactive -n --no-clobber)'{-i,--interactive}'[prompt before overwriting existing file]'
+ '--strip-trailing-slashes[remove any trailing slashes from each source argument]'
+ '(-S --suffix)'{-S+,--suffix=}'[specify the backup suffix]:backup suffix [~]'
+ '(-t --target-directory)'{-t+,--target-directory=}'[move all source arguments into specified directory]:directory:_directories'
+ '(-T --no-target-directory)'{-T,--no-target-directory}'[treat final argument as a normal file]'
+ '(-u --update)'{-u,--update}'[move only when destination file is older or missing]'
+ '(-v --verbose)'{-v,--verbose}'[show file names after they are moved]'
+ '(- *)--help[display usage information]'
+ '(- *)--version[display version information]'
+ )
+ [[ $OSTYPE = linux* ]] && args+=(
+ '(-Z --context)'{-Z,--context}'[set SELinux security context of destination file to default type]'
+ )
+ ;;
+ *)
+ args=(
+ "(-i -n)-f[don't prompt before overwriting]"
+ '(-f -n)-i[prompt before overwriting existing file]'
+ )
+ ;|
+ darwin*|dragonfly*|freebsd*)
+ args+=(
+ "(-f -i)-n[don't overwrite existing file]"
+ )
+ ;|
+ darwin*|dragonfly*|*bsd*)
+ args+=(
+ '-v[show file names after they are moved]'
+ )
+ ;|
+ dragonfly*|freebsd*)
+ args+=(
+ "-h[if target is a symlink to a directory, don't follow it]"
+ )
+ ;;
+esac
+
+_arguments -s -S $aopts $args \
+ '*: :_files'