Package: devscripts
Version: 2.15.4
Severity: wishlist
Tags: patch

Dear Maintainer,

 It is my "bash completion for devscripts tools" series, and this time
 I'd send patch for dcut. Could you check it, please?

-- 
Regards,
 
  Hideki Yamane <henr...@debian.org>
>From d2fac6164dbe0e37e202a52880fc2fd5fc107e6f Mon Sep 17 00:00:00 2001
From: Hideki Yamane <henr...@debian.org>
Date: Sun, 31 May 2015 16:49:32 +0900
Subject: [PATCH] add bash-completion for dcut

---
 scripts/dcut.bash_completion | 46 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 scripts/dcut.bash_completion

diff --git a/scripts/dcut.bash_completion b/scripts/dcut.bash_completion
new file mode 100644
index 0000000..4a1a6bd
--- /dev/null
+++ b/scripts/dcut.bash_completion
@@ -0,0 +1,46 @@
+have dcut &&
+_dcut()
+{
+    local cur prev options commands
+
+    COMPREPLY=()
+    cur=${COMP_WORDS[COMP_CWORD]}
+    prev=${COMP_WORDS[COMP_CWORD-1]}
+    options='-c --config -d -h --host -s -m --maintainer -k --keyid
+             -t -O --output -P --passive -s --simulate -U --upload
+             -i --input -v --version'
+    commands='mv rm cancel'
+
+    case $prev in
+	-k | --keyid)
+	    keyid_options=`gpg -K|grep ^sec|cut -d'/' -f2|cut -d' ' -f1`
+	    COMPREPLY=( $( compgen -W "$keyid_options" | grep ^$cur ) )
+	    ;;
+	mv | rm | cancel)
+	    COMPREPLY=( $(
+		    compgen -G "${cur}*.changes"
+		    compgen -G "${cur}*.commands"
+		) )
+	    ;;
+	-*)
+	    COMPREPLY=( $(
+		    compgen -G "${cur}*.changes"
+		    compgen -G "${cur}*.dsc"
+		    compgen -G "${cur}*.commands"
+		) )
+	    ;;
+	*)
+	    COMPREPLY=( $(
+		    compgen -G "${cur}*.changes"
+		    compgen -G "${cur}*.dsc"
+		    compgen -G "${cur}*.commands"
+		    compgen -W "$commands" | grep "^$cur"
+		    compgen -W "$options" | grep "^$cur"
+		) )
+	    ;;
+    esac
+
+    return 0
+
+}
+[ "$have" ] && complete -F _dcut -o filenames dcut
-- 
2.1.4

Reply via email to