diff options
Diffstat (limited to 'contrib/completion')
-rw-r--r-- | contrib/completion/bash/devtools.in | 80 | ||||
-rw-r--r-- | contrib/completion/zsh/_devtools.in | 89 |
2 files changed, 144 insertions, 25 deletions
diff --git a/contrib/completion/bash/devtools.in b/contrib/completion/bash/devtools.in index 3faad27..11fa234 100644 --- a/contrib/completion/bash/devtools.in +++ b/contrib/completion/bash/devtools.in @@ -3,12 +3,18 @@ # SPDX-License-Identifier: GPL-3.0-or-later _DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@} +# shellcheck source=src/lib/valid-build-install.sh +source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-build-install.sh # shellcheck source=src/lib/valid-tags.sh source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-tags.sh # shellcheck source=src/lib/valid-repos.sh source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-repos.sh +# shellcheck source=src/lib/valid-inspect.sh +source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-inspect.sh +# shellcheck source=src/lib/valid-search.sh +source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-search.sh -_binary_arch=${_arch[*]:0:-1} +_binary_arch=${DEVTOOLS_VALID_ARCHES[*]:0:-1} _colors=(never always auto) @@ -24,6 +30,7 @@ _makechrootpkg_args=( -n -T -U + -x ) _makechrootpkg_args_d_opts() { _filedir -d; } _makechrootpkg_args_D_opts() { _filedir -d; } @@ -31,6 +38,7 @@ _makechrootpkg_args_r_opts() { _filedir -d; } _makechrootpkg_args_I_opts() { _filedir '*.pkg.tar.*'; } _makechrootpkg_args_l_opts() { _filedir -d; } _makechrootpkg_args_U_opts() { :; } +_makechrootpkg_args_x_opts() { _devtools_completions_inspect; } _makechrootpkg() { __devtools_complete _makechrootpkg; } complete -F _makechrootpkg makechrootpkg @@ -38,6 +46,7 @@ complete -F _makechrootpkg makechrootpkg _makerepropkg_args=( -h -d + -n -c -M ) @@ -128,12 +137,14 @@ complete -F _offload_build offload-build _pkgctl_cmds=( + aur auth build db diff release repo + search version ) _pkgctl_args=( @@ -169,10 +180,14 @@ _pkgctl_build_args=( -o --offload -c --clean -w --worker + --inspect + -I --install-to-chroot + -i --install-to-host --pkgver --pkgrel --rebuild + --update-checksums -e --edit -r --release @@ -185,11 +200,19 @@ _pkgctl_build_args__arch_opts() { _devtools_completions_arch; } _pkgctl_build_args__repo_opts() { _devtools_completions_repo; } _pkgctl_build_args__worker_opts() { :; } _pkgctl_build_args_w_opts() { _pkgctl_build_args__worker_opts; } +_pkgctl_build_args__inspect_opts() { _devtools_completions_inspect; } _pkgctl_build_args__pkgver_opts() { :; } _pkgctl_build_args__pkgrel_opts() { :; } +_pkgctl_build_args__install_to_host_opts() { _pkgctl_build_completions_install_mode; } +_pkgctl_build_args_i_opts() { _pkgctl_build_args__install_to_host_opts; } +_pkgctl_build_args__install_to_chroot_opts() { _makechrootpkg_args_I_opts; } +_pkgctl_build_args_I_opts() { _pkgctl_build_args__install_to_chroot_opts; } _pkgctl_build_args__message_opts() { :; } _pkgctl_build_args_m_opts() { _pkgctl_build_args__message_opts; } _pkgctl_build_opts() { _filedir -d; } +_pkgctl_build_completions_install_mode() { + mapfile -t COMPREPLY < <(compgen -W "${DEVTOOLS_VALID_BUILD_INSTALL[*]}" -- "$cur") +} _pkgctl_db_cmds=( @@ -253,6 +276,17 @@ _pkgctl_release_args__repo_opts() { _devtools_completions_repo; } _pkgctl_release_args_r_opts() { _pkgctl_release_args__repo_opts; } _pkgctl_release_opts() { _filedir -d; } +_pkgctl_aur_cmds=( + drop-from-repo +) + +_pkgctl_aur_drop_from_repo_args=( + --no-disown + -f --force + -h --help +) +_pkgctl_aur_drop_from_repo_opts() { _filedir -d; } + _pkgctl_repo_cmds=( clone @@ -297,7 +331,6 @@ _pkgctl_repo_create_args=( -h --help ) - _pkgctl_repo_switch_args=( --discard-changes -f --force @@ -315,13 +348,44 @@ _pkgctl_repo_switch_opts() { fi } +_pkgctl_version_cmds=( + check + upgrade +) + +_pkgctl_version_check_args=( + -v --verbose + -h --help +) + +_pkgctl_version_check_opts() { _filedir -d; } + +_pkgctl_version_upgrade_args=( + -v --verbose + -h --help +) + +_pkgctl_version_upgrade_opts() { _filedir -d; } _pkgctl_repo_web_args=( + --print -h --help ) _pkgctl_repo_web_opts() { _filedir -d; } +_pkgctl_search_args=( + --no-default-filter + --json + -F --format + -N --no-line-number + -h --help +) +_pkgctl_search_opts() { :; } +_pkgctl_search_args__format_opts() { _devtools_completions_search_format; } +_pkgctl_search_args_F_opts() { _devtools_completions_search_format; } + + _pkgctl_diff_args=( -l --list -d --diffoscope @@ -355,14 +419,14 @@ _devtools_completions_color() { mapfile -t COMPREPLY < <(compgen -W "${_colors[*]}" -- "$cur") } _devtools_completions_arch() { - mapfile -t COMPREPLY < <(compgen -W "${_arch[*]}" -- "$cur") + mapfile -t COMPREPLY < <(compgen -W "${DEVTOOLS_VALID_ARCHES[*]}" -- "$cur") } _devtools_completions_repo() { local optional=${1:-} - mapfile -t COMPREPLY < <(compgen -W "${optional} ${_repos[*]}" -- "$cur") + mapfile -t COMPREPLY < <(compgen -W "${optional} ${DEVTOOLS_VALID_REPOS[*]}" -- "$cur") } _devtools_completions_build_repo() { - mapfile -t COMPREPLY < <(compgen -W "${_build_repos[*]}" -- "$cur") + mapfile -t COMPREPLY < <(compgen -W "${DEVTOOLS_VALID_BUILDREPOS[*]}" -- "$cur") } _devtools_completions_all_packages() { mapfile -t COMPREPLY < <(compgen -W "$(pacman -Sql)" -- "$cur") @@ -370,6 +434,12 @@ _devtools_completions_all_packages() { _devtools_completions_protocol() { mapfile -t COMPREPLY < <(compgen -W "https" -- "$cur") } +_devtools_completions_inspect() { + mapfile -t COMPREPLY < <(compgen -W "${DEVTOOLS_VALID_INSPECT_MODES[*]}" -- "$cur") +} +_devtools_completions_search_format() { + mapfile -t COMPREPLY < <(compgen -W "${valid_search_output_format[*]}" -- "$cur") +} __devtools_complete() { local service=$1 diff --git a/contrib/completion/zsh/_devtools.in b/contrib/completion/zsh/_devtools.in index a473bc2..ee6da85 100644 --- a/contrib/completion/zsh/_devtools.in +++ b/contrib/completion/zsh/_devtools.in @@ -3,12 +3,18 @@ # SPDX-License-Identifier: GPL-3.0-or-later _DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@} +# shellcheck source=src/lib/valid-build-install.sh +source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-build-install.sh # shellcheck source=src/lib/valid-tags.sh source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-tags.sh # shellcheck source=src/lib/valid-repos.sh source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-repos.sh +# shellcheck source=src/lib/valid-inspect.sh +source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-inspect.sh +# shellcheck source=src/lib/valid-search.sh +source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-search.sh -_binary_arch=${_arch[*]:0:-1} +_binary_arch=${DEVTOOLS_VALID_ARCHES[*]:0:-1} _colors=(never always auto) _archbuild_args=( @@ -36,17 +42,20 @@ _pkgctl_auth_status_args=( _pkgctl_build_args=( "--arch=[Specify architectures to build for (disables auto-detection)]:arch:($_arch[*])" - "--repo=[Specify a target repository (disables auto-detection)]:repo:($_repos[*])" + "--repo=[Specify a target repository (disables auto-detection)]:repo:($DEVTOOLS_VALID_REPOS[*])" '(-s --staging)'{-s,--staging}'[Build against the staging counterpart of the auto-detected repo]' '(-t --testing)'{-t,--testing}'[Build against the testing counterpart of the auto-detected repo]' '(-o --offload)'{-o,--offload}'[Build on a remote server and transfer artifacts afterwards]' '(-c --clean)'{-c,--clean}'[Recreate the chroot before building]' - '(-I --install)'{-I,--install}'[Install a package into the working copy of the chroot]:target:_files -g "*.pkg.tar.*(.)"' + "--inspect[Spawn an interactive shell to inspect the chroot (never, always, failure)]:inspect:($DEVTOOLS_VALID_INSPECT_MODES[*])" + '*'{-I,--install-to-chroot}'[Install a package to the working copy of the chroot]:target:_files -g "*.pkg.tar.*(.)"' + '*'{-i,--install-to-host}"[Install the built packages to the host system]:mode:($DEVTOOLS_VALID_BUILD_INSTALL[*])" '(-w --worker)'{-w,--worker}'[Name of the worker slot, useful for concurrent builds (disables auto-detection)]:slot:' '--nocheck[Do not run the check() function in the PKGBUILD]' '--pkgver=[Set pkgver, reset pkgrel and update checksums]:pkgver:' '--pkgrel=[Set pkgrel to a given value]:pkgrel:' '--rebuild[Increment the pkgrel variable]' + '--update-checksums[Force computation and update of the checksums (disables auto-detection)]' '(-e --edit)'{-e,--edit}'[Edit the PKGBUILD before building]' '(-r --release)'{-r,--release}'[Automatically commit, tag and release after building]' '(-m --message=)'{-m,--message=}"[Use the given <msg> as the commit message]:message:" @@ -64,15 +73,15 @@ _pkgctl_db_cmds=( _pkgctl_db_move_args=( '(-h --help)'{-h,--help}'[Display usage]' - "1:src-repo:($_repos[*])" - "2:target-repo:($_repos[*])" + "1:src-repo:($DEVTOOLS_VALID_REPOS[*])" + "2:target-repo:($DEVTOOLS_VALID_REPOS[*])" '*:pkgbase:_devtools_completions_all_packages' ) _pkgctl_db_remove_args=( '(-a --arch=)'{-a,--arch=}"[Override the architecture (disables auto-detection)]:arch:($_arch[*])" '(-h --help)'{-h,--help}'[Display usage]' - "1:repo:($_repos[*])" + "1:repo:($DEVTOOLS_VALID_REPOS[*])" '*:pkgbase:_devtools_completions_all_packages' ) @@ -82,7 +91,7 @@ _pkgctl_db_update_args=( _pkgctl_release_args=( '(-m --message=)'{-m,--message=}"[Use the given <msg> as the commit message]:message:" - '(-r --repo=)'{-r,--repo=}"[Specify a target repository (disables auto-detection)]:repo:($_repos[*])" + '(-r --repo=)'{-r,--repo=}"[Specify a target repository for new packages]:repo:($DEVTOOLS_VALID_REPOS[*])" '(-s --staging)'{-s,--staging}'[Release to the staging counterpart of the auto-detected repo]' '(-t --testing)'{-t,--testing}'[Release to the testing counterpart of the auto-detected repo]' '(-u --db-update)'{-u,--db-update}'[Automatically update the pacman database after uploading]' @@ -90,6 +99,18 @@ _pkgctl_release_args=( '*:git_dir:_files -/' ) +_pkgctl_aur_cmds=( + "pkgctl aur command" + "drop-from-repo[Drop a package from the official repository to the AUR]" +) + +_pkgctl_aur_drop_from_repo_args=( + '(-f --force)'{-f,--force}'[Force push to the AUR overwriting the remote repository]' + '--no-disown[Do not disown the package on the AUR]' + '(-h --help)'{-h,--help}'[Display usage]' + '*:git_dir:_files -/' +) + _pkgctl_repo_cmds=( "pkgctl repo command" "clone[Clone a package repository]" @@ -130,15 +151,25 @@ _pkgctl_repo_create_args=( ) _pkgctl_repo_web_args=( + '--print[Print the url instead of opening it with xdg-open]' '(-h --help)'{-h,--help}'[Display usage]' '*:git_dir:_files -/' ) +_pkgctl_search_args=( + '--no-default-filter[Do not apply default filter (like -path:keys/pgp/*.asc)]' + '--json[Enable printing results in JSON]' + '(-F --format)'{-F,--format}"[Controls the formatting of the results]:format:($valid_search_output_format[*])" + '(-N --no-line-number)'{-N,--no-line-number}"[Don't show line numbers when formatting results]" + '(-h --help)'{-h,--help}'[Display usage]' + '1:query' +) + _arch_nspawn_args=( '-C[Location of a pacman config file]:pacman_config:_files -g "*.conf(.)"' '-M[Location of a makepkg config file]:makepkg_config:_files -g "*.conf(.)"' - '-c[Set pacman cache]:pacman_cache:_files -/' - '-f[Copy file from the host to the chroot]:copy_file:_files' + '*-c[Set pacman cache]:pacman_cache:_files -/' + '*-f[Copy file from the host to the chroot]:copy_file:_files' '-s[Do not run setarch]' '-h[Display usage]' '1:chroot_dir:_files -/' @@ -146,14 +177,14 @@ _arch_nspawn_args=( _archrelease_args=( '-f[Force release without checks]' - "*:arch:($_tags[*])" + "*:arch:($DEVTOOLS_VALID_TAGS[*])" ) _commitpkg_args=( '-f[Force release without checks]' '-s[Target repo server]' '-l[Set bandwidth limit]:limit' - "-a[Release to a specific architecture only]:arch:($_arch[*])" + "-a[Release to a specific architecture only]:arch:($DEVTOOLS_VALID_ARCHES[*])" '1:commit_msg' ) @@ -180,15 +211,16 @@ _finddeps_args=( _makechrootpkg_args=( '-h[Display usage]' '-c[Clean the chroot before building]' - '-d[Bind directory into build chroot as read-write]:bind_dir_rw:_files -/' - '-D[Bind directory into build chroot as read-only]:bind_dir_ro:_files -/' + '*-d[Bind directory into build chroot as read-write]:bind_dir_rw:_files -/' + '*-D[Bind directory into build chroot as read-only]:bind_dir_ro:_files -/' '-u[Update the working copy of the chroot before building]' '-r[The chroot dir to use]:chroot_dir:_files -/' - '-I[Install a package into the working copy]:target:_files -g "*.pkg.tar.*(.)"' + '*-I[Install a package into the working copy]:target:_files -g "*.pkg.tar.*(.)"' '-l[The directory to use as the working copy]:copy_dir:_files -/' '-n[Run namcap on the package]' '-T[Build in a temporary directory]' '-U[Run makepkg as a specified user]:makepkg_user' + "-x[Spawn an interactive shell to inspect the chroot (never, always, failure)]:inspect:($DEVTOOLS_VALID_INSPECT_MODES[*])" ) _mkarchroot_args=( @@ -212,12 +244,12 @@ _sogrep_args=( '(-v --verbose)'{-v,--verbose}'[Show matched links in addition to pkgname]' '(-r --refresh)'{-r,--refresh}'[Refresh the links databases]' '(-h --help)'{-h,--help}'[Display usage]' - '1:repo:(all $_repos[*])' + '1:repo:(all $DEVTOOLS_VALID_REPOS[*])' '2:libname' ) _offload_build_args=( - '(-r --repo)'{-r,--repo}'[Build against a specific repository]:repo:($_build_repos[*])' + '(-r --repo)'{-r,--repo}'[Build against a specific repository]:repo:($DEVTOOLS_VALID_BUILDREPOS[*])' '(-a --arch)'{-a,--arch}'[Build against a specific architecture]:arch:(${_binary_arch[*]})' '(-s --server)'{-s,--server}'[Offload to a specific Build server]:server:' '(-h --help)'{-h,--help}'[Display usage]' @@ -225,6 +257,7 @@ _offload_build_args=( _makerepropkg_args=( '-d[Run diffoscope if the package is unreproducible]' + '-n[Do not run the check() function in the PKGBUILD]' '-c[Set pacman cache]:pacman_cache:_files -/' '-M[Location of a makepkg config file]:makepkg_config:_files -g "*.conf(.)"' '-h[Display usage]' @@ -239,13 +272,15 @@ _devtools_completions_all_packages() { _pkgctl_cmds=( "pkgctl command" + "aur[Interact with the Arch User Repository (AUR)]" "auth[Authenticate with services like GitLab]" "build[Build packages inside a clean chroot]" - "db[Pacman database modification for packge update, move etc]" + "db[Pacman database modification for package update, move etc]" "diff[Compare package files using different modes]" "release[Release step to commit, tag and upload build artifacts]" "repo[Manage Git packaging repositories and their configuration]" - "version[Show pkgctl version information]" + "search[Search for an expression across the GitLab packaging group]" + "version[Check and manage package versions against upstream]" ) _pkgctl_args=( @@ -253,8 +288,22 @@ _pkgctl_args=( '(-h --help)'{-h,--help}'[Display usage]' ) -_pkgctl_version_args=( +_pkgctl_version_cmds=( + "pkgctl version command" + "check[Compares local package versions against upstream versions]" + "upgrade[Adjust the PKGBUILD to match the latest upstream version]" +) + +_pkgctl_version_check_args=( + '(-v --verbose)'{-v,--verbose}'[Display results including up-to-date versions]' + '(-h --help)'{-h,--help}'[Display usage]' + '*:git_dir:_files -/' +) + +_pkgctl_version_upgrade_args=( + '(-v --verbose)'{-v,--verbose}'[Display results including up-to-date versions]' '(-h --help)'{-h,--help}'[Display usage]' + '*:git_dir:_files -/' ) _pkgctl_diff_args=("${_diffpkg_args[@]}") @@ -276,7 +325,7 @@ _handle_subcommands() { fi ;; args) - local service_sub=${service_name}_$line[1] + local service_sub=${service_name}_${line[1]//-/_} if typeset -p ${service_sub}_args &> /dev/null; then local cmd_args=${service_sub}_args[@] _arguments -s "${(P)cmd_args}" |