19 Commits 5d95bcc2b9 ... ea5c57cce5

Autor SHA1 Nachricht Datum
  Ben Finney ea5c57cce5 Correct the Bash completion script behaviour. vor 8 Jahren
  Ben Finney 0878a3e79b Document in the changelog the ‘dcut’ completion improvement. vor 8 Jahren
  Ben Finney 24fb92dec3 Install the script for ‘dcut’ command completion. vor 8 Jahren
  Ben Finney eefe769f69 Add Bash script for completion of ‘dcut’ command. vor 8 Jahren
  Ben Finney 33a702ea1f Document in the changelog the ‘dput’ completion improvements. vor 8 Jahren
  Ben Finney b3fd0dad34 Construct the set of options as a Bash array. vor 8 Jahren
  Ben Finney ee25b7c708 Apply completion options only when appropriate for the case. vor 8 Jahren
  Ben Finney 92f047d9d7 Construct the values for ‘--delayed’ by a sequence expression. vor 8 Jahren
  Ben Finney 6c7b18de24 Use correct idiom to specify current word for matching. vor 8 Jahren
  Ben Finney 648af348b6 Correct the completion glob for source control files. vor 8 Jahren
  Ben Finney 5dfa82bbb8 Signature files are not input to the command; remove the attempt to match. vor 8 Jahren
  Ben Finney 6dd782a442 Execute search for hostnames once, across all config files. vor 8 Jahren
  Ben Finney e1135bfaca Define cases with the conventional order for options spellings. vor 8 Jahren
  Ben Finney 6b102e5a53 Remove a superfluous conflation of separate collections. vor 8 Jahren
  Ben Finney 7653cae489 Migrate from deprecated completion helper function. vor 8 Jahren
  Ben Finney 81d7ecb5ac Remove superfluous declarations of local variables. vor 8 Jahren
  Ben Finney 10a64dcda3 Properly quote values that could contains special characters. vor 8 Jahren
  Ben Finney 3c966ad28d Standardise bash-completion continuation and indentation. vor 8 Jahren
  Ben Finney 4b05a7e029 Move ‘dput’ Bash completion to a script explicitly named for the command. vor 8 Jahren
5 geänderte Dateien mit 202 neuen und 67 gelöschten Zeilen
  1. 108 0
      bash-completion/dcut.bash
  2. 84 0
      bash-completion/dput.bash
  3. 2 1
      debian/bash-completion
  4. 8 0
      debian/changelog
  5. 0 66
      dput/bash-completion

+ 108 - 0
bash-completion/dcut.bash

@@ -0,0 +1,108 @@
+# bash-completion/dcut.bash
+# Programmable Bash command completion for ‘dcut’ command.
+# See the Bash manual “Programmable Completion” section.
+#
+# This is free software, and you are welcome to redistribute it under
+# certain conditions; see the end of this file for copyright
+# information, grant of license, and disclaimer of warranty.
+
+_have dcut &&
+_dcut () {
+    COMPREPLY=()
+
+    local cur="${COMP_WORDS[COMP_CWORD]}"
+    local prev="${COMP_WORDS[COMP_CWORD-1]}"
+    local options=(
+            --host
+            -O --output
+            -P --passive
+            -U --upload
+            -c --config
+            -d --debug
+            -h --help
+            -i --input
+            -k --keyid
+            -m --maintaineraddress
+            -s --simulate
+            -v --version
+            )
+
+    local config_files=(
+            "$HOME/.dput.cf"
+            "/etc/dput.cf"
+            )
+    local hosts=$( {
+            grep --no-filename "^\[.*\]" "${config_files[@]}" \
+                2> /dev/null \
+                | tr --delete '[]' || /bin/true
+            } | grep --invert-match '^DEFAULT$' | sort --unique )
+
+    local queue_commands=(
+            cancel
+            reschedule
+            rm
+            )
+
+    case "$prev" in
+        -c|--config)
+            COMPREPLY=( $( compgen -G "${cur}*" ) )
+            compopt -o filenames
+            compopt -o plusdirs
+            ;;
+        -k|--keyid)
+            # FIXME: gathering the secret keys can typically take
+            # several seconds by this method. Is there a faster way to
+            # reliably present the current user's secret key IDs?
+            local keyids=( $(
+                    gpg2 --list-secret-keys --keyid-format short \
+                        2> /dev/null \
+                        | grep '^sec' \
+                        | cut --delimiter ' ' --fields 4 \
+                        | cut --delimiter '/' --fields 2 \
+                        | sort --unique
+                    ) )
+            COMPREPLY=( $( compgen -W "${keyids[*]}" -- "$cur" ) )
+            ;;
+        -i|--input)
+            COMPREPLY=( $( compgen -G "${cur}*.changes" ) )
+            compopt -o filenames
+            compopt -o plusdirs
+            ;;
+        -U|--upload|-O|--output)
+            COMPREPLY=( $( compgen -G "${cur}*.commands" ) )
+            compopt -o filenames
+            compopt -o plusdirs
+            ;;
+        --host)
+            COMPREPLY=( $( compgen -W "$hosts" -- "$cur" ) )
+            ;;
+        ',')
+            COMPREPLY=( $( compgen -W "${queue_commands[*]}" -- "$cur" ) )
+            ;;
+        *)
+            COMPREPLY=( $(
+                    compgen -W "$hosts" -- "$cur"
+                    compgen -W "${queue_commands[*]}" -- "$cur"
+                    compgen -W "${options[*]}" -- "$cur"
+                    ) )
+            ;;
+    esac
+
+    return 0
+
+} && complete -F _dcut dcut
+
+
+# Copyright © 2015–2016 Ben Finney <bignose@debian.org>
+# Copyright © 2002 Roland Mas <lolando@debian.org>
+#
+# This is free software: you may copy, modify, and/or distribute this work
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 3 of that license or any later version.
+# No warranty expressed or implied. See the file ‘LICENSE.GPL-3’ for details.
+
+# Local variables:
+# coding: utf-8
+# mode: sh
+# End:
+# vim: fileencoding=utf-8 filetype=sh :

+ 84 - 0
bash-completion/dput.bash

@@ -0,0 +1,84 @@
+# bash-completion/dput.bash
+# Programmable Bash command completion for ‘dput’ command.
+# See the Bash manual “Programmable Completion” section.
+#
+# This is free software, and you are welcome to redistribute it under
+# certain conditions; see the end of this file for copyright
+# information, grant of license, and disclaimer of warranty.
+
+_have dput &&
+_dput () {
+    COMPREPLY=()
+
+    local cur="${COMP_WORDS[COMP_CWORD]}"
+    local prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    local options=(
+            -D --dinstall
+            -H --host-list
+            -P --passive
+            -U --no-upload-log
+            -V --check-version
+            -c --config
+            -d --debug
+            -e --delayed
+            -f --force
+            -h --help
+            -l --lintian
+            -o --check-only
+            -p --print
+            -s --simulate
+            -u --unchecked
+            -v --version
+            )
+
+    local config_files=(
+            "$HOME/.dput.cf"
+            "/etc/dput.cf"
+            )
+    local hosts=$( {
+            grep --no-filename "^\[.*\]" "${config_files[@]}" \
+                2> /dev/null \
+                | tr --delete [] || /bin/true
+            } | grep --invert-match '^DEFAULT$' | sort --unique )
+
+    case "$prev" in
+        -e|--delayed)
+            local delayed_values=( {0..15} )
+            COMPREPLY=( $( compgen -W "${delayed_values[*]}" -- "$cur" ) )
+            ;;
+        -c|--config)
+            COMPREPLY=( $( compgen -G "${cur}*" ) )
+            compopt -o filenames
+            compopt -o plusdirs
+            ;;
+        *)
+            COMPREPLY=( $(
+                    compgen -G "${cur}*.changes"
+                    compgen -G "${cur}*.dsc"
+                    compgen -W "$hosts" -- "$cur"
+                    compgen -W "${options[*]}" -- "$cur"
+                    ) )
+            compopt -o filenames
+            compopt -o plusdirs
+            ;;
+    esac
+
+    return 0
+
+} && complete -F _dput dput
+
+
+# Copyright © 2015–2016 Ben Finney <bignose@debian.org>
+# Copyright © 2002 Roland Mas <lolando@debian.org>
+#
+# This is free software: you may copy, modify, and/or distribute this work
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 3 of that license or any later version.
+# No warranty expressed or implied. See the file ‘LICENSE.GPL-3’ for details.
+
+# Local variables:
+# coding: utf-8
+# mode: sh
+# End:
+# vim: fileencoding=utf-8 filetype=sh :

+ 2 - 1
debian/bash-completion

@@ -2,4 +2,5 @@
 # Bash command completion scripts to install for the ‘dput’ package.
 # Manual page: ‘dh_bash-completion(1)’.
 
-dput/bash-completion    dput
+bash-completion/dput.bash    dput
+bash-completion/dcut.bash    dcut

+ 8 - 0
debian/changelog

@@ -1,3 +1,11 @@
+dput (0.11.1) UNRELEASED; urgency=medium
+
+  * Bash completion improvements:
+    * Correct matching of filenames for ‘dput’ commands.
+    * Add script for ‘dcut’ command completion.
+
+ --
+
 dput (0.11.0) unstable; urgency=medium
 
   * The “Asif Mohiuddin” release.

+ 0 - 66
dput/bash-completion

@@ -1,66 +0,0 @@
-# dput/bash-completion
-# Programmable Bash command completion for Dput commands.
-# See the Bash manual “Programmable Completion” section.
-#
-# This is free software, and you are welcome to redistribute it under
-# certain conditions; see the end of this file for copyright
-# information, grant of license, and disclaimer of warranty.
-
-have dput &&
-_dput()
-{
-    local cur prev options paroptions special i delayed_options hosts
-
-    COMPREPLY=()
-    cur=${COMP_WORDS[COMP_CWORD]}
-    prev=${COMP_WORDS[COMP_CWORD-1]}
-    options='-c --config -d --debug -D --dinstall -f --force -h --help \
-             -H --host-list -l --lintian -o --check-only -p --print \
-             -P --passive -s --simulate -u --unchecked -e --delayed \
-             -v --version -V --check-version'
-
-    hosts=$(
-        {
-            grep "^\[.*\]" $HOME/.dput.cf 2> /dev/null | tr -d [] || /bin/true
-            grep "^\[.*\]" /etc/dput.cf 2> /dev/null | tr -d [] || /bin/true
-        } | grep -v '^DEFAULT$' | sort -u)
-
-    paroptions="$options $hosts"
-
-    case $prev in
-        --delayed|-e)
-            delayed_options='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15'
-            COMPREPLY=( $( compgen -W "$delayed_options" | grep ^$cur ) )
-            ;;
-        --config|-c)
-            COMPREPLY=( $( compgen -o filenames -G "$cur*" ) )
-            ;;
-        *)
-            COMPREPLY=( $(
-                    compgen -G "${cur}*.changes"
-                    compgen -G "${cur}*.asc"
-                    compgen -G "${cur}*.sig"
-                    compgen -W "$paroptions" | grep "^$cur"
-                ) )
-            ;;
-    esac
-
-    return 0
-
-}
-[ "$have" ] && complete -F _dput -o filenames -o plusdirs dput
-
-
-# Copyright © 2015–2016 Ben Finney <bignose@debian.org>
-# Copyright © 2002 Roland Mas <lolando@debian.org>
-#
-# This is free software: you may copy, modify, and/or distribute this work
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; version 3 of that license or any later version.
-# No warranty expressed or implied. See the file ‘LICENSE.GPL-3’ for details.
-
-# Local variables:
-# coding: utf-8
-# mode: sh
-# End:
-# vim: fileencoding=utf-8 filetype=sh :