Package: quintuple-agent Version: 1.0.4-4 Severity: wishlist Tags: patch
Install attached file as /etc/bash_completion.d/quintuple-agent for q-client bash completion. It is my first bash completion function, but so far, it works quite well for me. -- System Information: Debian Release: 3.1 APT prefers testing APT policy: (990, 'testing'), (800, 'unstable'), (100, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.11-rc2-vs1.9.4-rc3-ndim-1 Locale: LANG=C, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Versions of packages quintuple-agent depends on: ii libc6 2.3.2.ds1-20 GNU C Library: Shared libraries an ii libcap2 0.cvs.20010529-4 Support for POSIX.1e capabilities ii libglib1.2 1.2.10-9 The GLib library of C routines ii libgtk1.2 1.2.10-17 The GIMP Toolkit set of widgets fo ii libx11-6 4.3.0.dfsg.1-10 X Window System protocol client li ii libxext6 4.3.0.dfsg.1-10 X Window System miscellaneous exte ii libxi6 4.3.0.dfsg.1-10 X Window System Input extension li ii xlibs 4.3.0.dfsg.1-10 X Keyboard Extension (XKB) configu -- no debconf information
# bash completion for quintuple-agent # Copyright 2005 Hans Ulrich Niedermann <[EMAIL PROTECTED]> # License: GNU GPL v2 or later # * only handle completion for q-client # * handles all the common cases # * does not complete IDs for put, TTLs, and query parameters # * allows undefined combinations (stuff like having the same option twice) # * but it still is very useful have q-client && _q-client() { COMPREPLY=() local cur prev cur=${COMP_WORDS[COMP_CWORD]} prev="${COMP_WORDS[COMP_CWORD-1]}" local commands options commands="put get delete list" options="-d --debug --help --version" options="${options} -i --insure -q --query-options -t --time-to-live" # the command itself if [ "x$prev" = "xq-client" ]; then COMPREPLY=($( compgen -W "$commands $options" -- "$cur" )) return 0 fi # if extglob is on, accept all numbers as TTL if [ "$(shopt extglob | cut -f2)" = "on" ] && [ "x$prev" = "x-t" -o "x$prev" = "x--time-to-live" ] then case "$cur" in +([[:digit:]])) COMPREPLY=("$cur") return 0 ;; esac fi COMPREPLY=() # walk through the options and commands case "$prev" in get|delete) # list stored items local items items=($(q-client list 2>&1 | cut -f1)) if [ "$?" -eq 0 ]; then # only if we could connect to q-agent process COMPREPLY=($( compgen -W "${items[*]}" -- "$cur")) fi ;; list) ;; put) ;; --help) ;; --version) ;; -i|--insure) COMPREPLY=($( compgen -W "put ${options}" -- "$cur")) ;; -d|--debug) COMPREPLY=($( compgen -W "${commands} ${options}" -- "$cur")) ;; *) # unhandled, i.e. TTL or query option string if [ "$COMP_CWORD" -ge 2 ]; then local pprev pprev="${COMP_WORDS[COMP_CWORD-2]}" case "$pprev" in -q|--query-options) COMPREPLY=($( compgen -W "put ${options}" -- "$cur")) ;; -t|--time-to-live) COMPREPLY=($( compgen -W "put ${options}" -- "$cur")) ;; esac fi ;; esac return 0 } [ "$have" ] && complete -F _q-client q-client