diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2018-04-07 15:12:57 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2018-04-07 15:12:57 +0200 |
commit | 6e1ab9aa550695ee7e3d467b4173c0b83ba7f759 (patch) | |
tree | 8fb7faa4364a7cbf1cba48296a5f537e13f2a8d9 /Completion/Unix/Command/_mkdir | |
parent | 5ad56a41f1ee2e61abca079f5ea8909f895ac2dd (diff) | |
parent | f027f1d6e876708bc75d4217e1ca26898658d8d3 (diff) | |
download | zsh-6e1ab9aa550695ee7e3d467b4173c0b83ba7f759.tar.gz zsh-6e1ab9aa550695ee7e3d467b4173c0b83ba7f759.zip |
Merge tag 'zsh-5.4.2-test-2' / 'upstream' branch into 'debian' branch
Test version 2 prior to zsh 5.5.
Diffstat (limited to 'Completion/Unix/Command/_mkdir')
-rw-r--r-- | Completion/Unix/Command/_mkdir | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/Completion/Unix/Command/_mkdir b/Completion/Unix/Command/_mkdir index f2299f7c7..53536b01d 100644 --- a/Completion/Unix/Command/_mkdir +++ b/Completion/Unix/Command/_mkdir @@ -4,35 +4,26 @@ local curcontext="$curcontext" state line expl args variant ret=1 typeset -A opt_args args=( - '(-m --mode)'{-m,--mode=}'[set permission mode]:numeric mode' + '(-m --mode)'{-m,--mode=}'[set permission mode]: :_file_modes' '(-p --parents)'{-p,--parents}'[make parent directories as needed]' '(-)*: :->directories' ) -case "$OSTYPE" in - linux*) - args+=( - '(-Z --context)'{-Z,--context=}'[set SELinux context]:SELinux context' - ) - ;; -esac - -_pick_variant -r variant gnu=gnu zsh='\(eval\)' $OSTYPE --help # It can still happen that there is a precommand command or builtin in the line. # In such cases, the variant has to be modified suitably, after further checking # the variant of the _command_ mkdir. - -# I currently don't know of any way to find out what precommands are present on -# the line. The variant should be modified like this once a way is found out: - -# if [[ $variant == zsh ]]; then -# if [[ $precommand = *command* ]]; then -# _mkdir_command () { command mkdir "$@" } -# _pick_variant -c _mkdir_command -r variant gnu=gnu unix --help -# fi -# elif [[ $precommand = *builtin* ]]; then -# variant=zsh -# fi +# +# $precommands is defined in _main_complete +if (( ${+precommands[(r)command]} )); then + _mkdir_command () { command mkdir "$@" } + _pick_variant -c _mkdir_command -r variant gnu=gnu unix --help + unfunction _mkdir_command +elif (( ${+precommands[(r)builtin]} )) || (( ${+builtins[mkdir]} )) || [[ "$(type -w mkdir)" == "*: builtin" ]]; then + variant=zsh +else + _pick_variant -r variant gnu=gnu zsh='\(eval\)' $OSTYPE --help +fi +# Now $variant is set. case $variant in gnu|freebsd*|dragonfly*) @@ -41,13 +32,17 @@ case $variant in ) ;| gnu) + if [[ $OSTYPE == linux* ]]; then + args+=( + '(-Z --context)'{-Z,--context=}'[set SELinux context]:SELinux context' + ) + fi args+=( '(- :)--help[display help information]' '(- :)--version[display version information]' ) ;; zsh) # remove all options - args=( '*: :->directories' ) ;; *) # non-GNU: remove long options args=( ${${${args:#(|*\))--*}//--[^ )]#/}/\( #\)/} ) |