From 0d2edecb2be14c0ed92a33c7508358d648cd3d2f Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Wed, 3 Jul 2019 05:08:20 -0400 Subject: New upstream version 22 --- completion/_archinstallscripts.zsh | 163 +++++++++++++++++++++++++++++++++++++ completion/arch-chroot.bash | 27 ++++++ completion/genfstab.bash | 31 +++++++ completion/pacstrap.bash | 38 +++++++++ 4 files changed, 259 insertions(+) create mode 100644 completion/_archinstallscripts.zsh create mode 100644 completion/arch-chroot.bash create mode 100644 completion/genfstab.bash create mode 100644 completion/pacstrap.bash (limited to 'completion') diff --git a/completion/_archinstallscripts.zsh b/completion/_archinstallscripts.zsh new file mode 100644 index 0000000..d2c8c7b --- /dev/null +++ b/completion/_archinstallscripts.zsh @@ -0,0 +1,163 @@ +#compdef pacstrap genfstab arch-chroot + +_pacstrap_args=( + '-h[display help]' +) + +_pacstrap_args_nonh=( + '(-h --help)-c[Use the package cache on the host, rather than the target]' + '(--help -h)-i[Avoid auto-confirmation of package selections]' +) + + +# builds command for invoking pacman in a _call_program command - extracts +# relevant options already specified (config file, etc) +# $cmd must be declared by calling function +_pacman_get_command() { + # this is mostly nicked from _perforce + cmd=( "pacman" "2>/dev/null") + integer i + for (( i = 2; i < CURRENT - 1; i++ )); do + if [[ ${words[i]} = "--config" || ${words[i]} = "--root" ]]; then + cmd+=( ${words[i,i+1]} ) + fi + done +} + +# provides completions for packages available from repositories +# these can be specified as either 'package' or 'repository/package' +_pacman_completions_all_packages() { + local -a cmd packages repositories packages_long + _pacman_get_command + + if compset -P1 '*/*'; then + packages=( $(_call_program packages $cmd[@] -Sql ${words[CURRENT]%/*}) ) + typeset -U packages + _wanted repo_packages expl "repository/package" compadd ${(@)packages} + else + packages=( $(_call_program packages $cmd[@] -Sql) ) + typeset -U packages + _wanted packages expl "packages" compadd - "${(@)packages}" + + repositories=(${(o)${${${(M)${(f)"$( /dev/null; then + _completion_loader pacman +fi + +_pacstrap() { + compopt +o dirnames +o default + local cur prev opts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="-C -c -G -i -M -h" + + for i in "${COMP_WORDS[@]:1:COMP_CWORD-1}"; do + if [[ -d ${i} ]]; then + _pacman_pkg Slq + return 0 + fi + done + + case ${prev} in + -h) + return 0 + ;; + -C) + compopt -o default + return 0 + ;; + esac + + if [[ ${cur} = -* ]]; then + COMPREPLY=($(compgen -W "${opts}" -- "${cur}")) + return 0 + fi + + compopt -o dirnames +} + +complete -F _pacstrap pacstrap -- cgit v1.2.3