diff options
author | Daniel Shahaf <d.s@daniel.shahaf.name> | 2020-06-23 14:47:12 +0000 |
---|---|---|
committer | Daniel Shahaf <d.s@daniel.shahaf.name> | 2020-06-23 15:11:25 +0000 |
commit | e8d6bb612d4385e78c360171a7bb42819b572a8f (patch) | |
tree | adad39b557974c2d9911c6485c382b6e1fe6b37b | |
parent | 27586e0ea3e620d03d82bffc5627e27f7ea26eb1 (diff) | |
download | zsh-e8d6bb612d4385e78c360171a7bb42819b572a8f.tar.gz zsh-e8d6bb612d4385e78c360171a7bb42819b572a8f.zip |
Cherry-pick d128bc0b from upstream: 45731: _debsnap: New completion function
Closes: #960298
-rw-r--r-- | debian/patches/cherry-pick-d128bc0b-45731-debsnap-new-completion-function.patch | 87 | ||||
-rw-r--r-- | debian/patches/series | 1 |
2 files changed, 88 insertions, 0 deletions
diff --git a/debian/patches/cherry-pick-d128bc0b-45731-debsnap-new-completion-function.patch b/debian/patches/cherry-pick-d128bc0b-45731-debsnap-new-completion-function.patch new file mode 100644 index 000000000..e4b2ec2d8 --- /dev/null +++ b/debian/patches/cherry-pick-d128bc0b-45731-debsnap-new-completion-function.patch @@ -0,0 +1,87 @@ +Description: New _debsnap completion +Origin: upstream +Bug-Debian: https://bugs.debian.org/960298 +Forwarded: not-needed +Applied-Upstream: workers/45731 +Last-Update: 2020-06-23 + +--- /dev/null ++++ b/Completion/Debian/Command/_debsnap +@@ -0,0 +1,77 @@ ++#compdef debsnap ++ ++# Based on debsnap from devscripts-2.20.3 ++ ++local context state state_descr line ret=1 ++local -a expl ++typeset -A opt_args ++ ++_arguments \ ++ '(-d --destdir)'{-d+,--destdir=}'[set download directory]:download directory:_files -/' \ ++ '(-f --force)'{-f,--force}'[allow non-empty destination directory]' \ ++ '(-v --verbose)'{-v,--verbose}'[print configuration and report progress]' \ ++ --list"[list versions; don't download]" \ ++ --binary'[operate on binary packages (default: source packages)]' \ ++ '*'{-a+,--architecture=}'[specify architectures to download]:architecture to download:_deb_architectures' \ ++ --first='[download all versions newer than this]:version number (lower bound):->versions' \ ++ --last='[download all versions older than this]:version number (upper bound):->versions' \ ++ '(-)'{-h,--help}'[show usage information]' \ ++ '(-)'--version'[show version number and license]' \ ++ '1: :->package' \ ++ '2:version number to download:->versions' \ ++ && ret=0 ++ ++# -a implies --binary ++if (( ${+opt_args[-a]} || ${+opt_args[--architecture]} )); then ++ opt_args[--binary]='' ++fi ++ ++case $state in ++ (package) ++ if (( ${+opt_args[--binary]} )); then ++ _description binary-packages expl 'binary package to download' ++ _deb_packages "${expl[@]}" avail && ret=0 ++ else ++ _description source-packages expl 'source package to download' ++ _deb_packages "${expl[@]}" source && ret=0 ++ fi ++ ;; ++ (versions) ++ local package=${(Q)line[1]} ++ if [[ -n $package ]]; then ++ # Compute the arguments to --list ++ local -a args ++ () { ++ local i j ++ ++ # repeatable flags with arguments, where the values can't contain colons ++ for i in ${(k)opt_args[(I)(-a|--architecture)]}; do ++ for j in ${(@s.:.)opt_args[$i]}; do ++ [[ -n $j ]] || continue ++ args+=( $i $j ) ++ done ++ done ++ ++ # non-repeatable flags with arguments, where the values may contain colons ++ for i in ${(k)opt_args[(I)(--first|--last)]}; do ++ # Avoid spurious "No matches" results in 'debsnap --first 42.1 --last 42.<TAB>'. ++ [[ $context != option${i}-* ]] || continue ++ ++ # Un-escape colons (epoch separators in the version number) ++ args+=( $i ${(Q)opt_args[$i]} ) ++ done ++ ++ # flags without arguments ++ args+=( ${(k)opt_args[(I)(--binary)]} ) ++ } ++ ++ local -a versions=( ${(Oaf)"$(_call_program versions debsnap --list ${args} -- ${line[1]})"} ) ++ _description -V versions expl ${state_descr} ++ compadd "$@" "${expl[@]}" -a versions && ret=0 ++ else ++ _message -- $state_descr && ret=0 ++ fi ++ ;; ++esac ++ ++return ret diff --git a/debian/patches/series b/debian/patches/series index a721bd1e7..4310546b8 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,4 @@ update-debian-sections.patch cross-compile.diff example-shebang.patch completion-dscverify.diff +cherry-pick-d128bc0b-45731-debsnap-new-completion-function.patch |