aboutsummaryrefslogtreecommitdiffstats
path: root/bash-completion
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-01-04 22:15:09 -0500
committerDave Reisner <dreisner@archlinux.org>2013-01-04 22:15:09 -0500
commitf2746218d5630ffeb66884fafb85afaabc8c1f0c (patch)
tree8a937e2fecbff32ea5537b7e37fb231fcaf18535 /bash-completion
parentcaaec5a9461a4612a96e7eb7fe8f097f20ac774a (diff)
downloadmirror-ponymix-f2746218d5630ffeb66884fafb85afaabc8c1f0c.tar.gz
mirror-ponymix-f2746218d5630ffeb66884fafb85afaabc8c1f0c.tar.bz2
mirror-ponymix-f2746218d5630ffeb66884fafb85afaabc8c1f0c.zip
offer appropriate device completion for move
Diffstat (limited to 'bash-completion')
-rw-r--r--bash-completion16
1 files changed, 16 insertions, 0 deletions
diff --git a/bash-completion b/bash-completion
index c6040fc..56a8b95 100644
--- a/bash-completion
+++ b/bash-completion
@@ -83,6 +83,22 @@ _ponymix() {
COMPREPLY=($(compgen -W '${verbs[*]}' -- "$cur"))
;;
esac
+ [[ $COMPREPLY ]] && return 0
+
+ case $verb in
+ move)
+ if [[ $devtype = sink?(-input) ]]; then
+ while IFS=$'\t' read _ dev idx _; do
+ devices+=("$dev" "$idx")
+ done < <(\ponymix --sink list-short 2>/dev/null)
+ elif [[ $devtype = source?(-output) ]]; then
+ while IFS=$'\t' read _ dev idx _; do
+ devices+=("$dev" "$idx")
+ done < <(\ponymix --source list-short 2>/dev/null)
+ fi
+ ;;
+ esac
+ [[ $devices ]] && COMPREPLY=($(compgen -W '${devices[*]}' -- "$cur"))
return 0
}