/
githubmirror
/
bash-completion
Обзор
Документация
Войти
/
githubmirror
/
bash-completion
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.9
completions/chmod
40 строк
867 B
Ville Skyttä
*: make _parse_usage fallbacks more concise
14 апр 2019, 21:48
14 апр 2019, 21:48
3c10d4d
Код
Авторство
О чём код?
# chmod(1) completion -*- shell-script -*- _chmod() { local cur prev words cword split _init_completion -s || return case $prev in --help|--version) return ;; --reference) _filedir return ;; esac $split && return # Adapted from coreutils 8.28 chmod man page local modearg="-@(@(+([rwxXst])|[ugo])|+([0-7]))" if [[ $cur == -* && $cur != $modearg ]]; then local opts=$(_parse_help "$1") COMPREPLY=( $(compgen -W '${opts:-$(_parse_usage "$1")}' -- "$cur") ) [[ $COMPREPLY == *= ]] && compopt -o nospace return fi local args _count_args "" "" "$modearg" case $args in 1) ;; # mode *) _filedir ;; esac } && complete -F _chmod chmod # ex: filetype=sh