r677 - in /trunk/boinc/debian: changelog extra/bash/boinc extra/bash/boinc_cmd

fst-guest at users.alioth.debian.org fst-guest at users.alioth.debian.org
Mon Jun 25 17:54:27 UTC 2007


Author: fst-guest
Date: Mon Jun 25 17:54:25 2007
New Revision: 677

URL: http://svn.debian.org/wsvn/pkg-boinc/?sc=1&rev=677
Log:
Added BASH completion for boinc_client and improved the boinc_cmd completion.

Added:
    trunk/boinc/debian/extra/bash/boinc
      - copied, changed from r676, trunk/boinc/debian/extra/bash/boinc_cmd
Removed:
    trunk/boinc/debian/extra/bash/boinc_cmd
Modified:
    trunk/boinc/debian/changelog

Modified: trunk/boinc/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-boinc/trunk/boinc/debian/changelog?rev=677&op=diff
==============================================================================
--- trunk/boinc/debian/changelog (original)
+++ trunk/boinc/debian/changelog Mon Jun 25 17:54:25 2007
@@ -28,7 +28,7 @@
   * Added /usr/share/bug/boinc-client/script which pastes boinc-client's
     init script configuration file (/etc/default/boinc-client) into bug
     reports because this might be helpful for debugging.
-  * extra/bash/boinc_cmd: Added bash completion for boinc_cmd.
+  * extra/bash/boinc: Added bash completion for boinc_client and boinc_cmd.
   * debian/rules:
     - Don't ignore $(MAKE) distclean errors to make lintian happy.
     - Install unstripped versions of boinc_client, boinc_cmd and boincmgr
@@ -42,7 +42,7 @@
   * Added Portuguese (pt.po) by Miguel Figueiredo <elmig at debianpt.org>.
     (closes: #428278)
 
- -- Frank S. Thomas <frank at thomas-alfeld.de>  Mon, 25 Jun 2007 10:30:50 +0200
+ -- Frank S. Thomas <frank at thomas-alfeld.de>  Mon, 25 Jun 2007 19:52:21 +0200
 
 boinc (5.8.17-2) unstable; urgency=low
 

Copied: trunk/boinc/debian/extra/bash/boinc (from r676, trunk/boinc/debian/extra/bash/boinc_cmd)
URL: http://svn.debian.org/wsvn/pkg-boinc/trunk/boinc/debian/extra/bash/boinc?rev=677&op=diff
==============================================================================
--- trunk/boinc/debian/extra/bash/boinc_cmd (original)
+++ trunk/boinc/debian/extra/bash/boinc Mon Jun 25 17:54:25 2007
@@ -1,3 +1,39 @@
+_boinc_client()
+{
+    local cur prev opts
+    COMPREPLY=()
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts="$(boinc_client --help | \
+        sed -n -r 's/^[[:space:]]*(--[a-z_]*).*/\1/p')"
+
+    # Handle options that require one or more arguments.
+    case "$prev" in
+        --attach_project|--detach_project|--reset_project|--update_prefs|\
+        --gui_rpc_port)
+            return 0
+        ;;
+    esac
+
+    # Handle options that require two arguments.
+    if [[ COMP_CWORD -gt 1 ]]; then
+        pprev="${COMP_WORDS[COMP_CWORD-2]}"
+
+        case "$pprev" in
+            --attach_project)
+                return 0
+            ;;
+        esac
+    fi
+
+    if [[ "$cur" == -* ]]; then
+        COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
+        return 0
+    fi
+}
+complete -F _boinc_client -o default boinc_client
+
 _boinc_cmd()
 {
     local cur prev opts cmds
@@ -6,34 +42,43 @@
     prev="${COMP_WORDS[COMP_CWORD-1]}"
 
     opts="--host --passwd -h --help -V --version"
-    cmds="$(boinc_cmd --help 2>&1 | sed -r 's/^[[:space:]](--[a-z_]*).*/\1/' \
-        | grep '^--')"
+    cmds="$(boinc_cmd --help 2>&1 | \
+        sed -n -r 's/^[[:space:]]*(--[a-z_]*).*/\1/p')"
 
-    # The following if construct assures that:
+    # The following construct assures that:
     # - no command follows if one of $opts or $cmds was given
     # - after --host follows only one command or --passwd and one command
     # - after --passwd follows only one command
     if [[ $COMP_CWORD -eq 1 ]]; then
         COMPREPLY=( $(compgen -W "$opts $cmds" -- "$cur") )
         return 0
-    elif [[ "${COMP_WORDS[@]}" =~ ".* --passwd .*" ]]; then
-        if [[ "$prev" == --passwd ]]; then
-            return 0
-        elif [[ $COMP_CWORD -lt 6 ]]; then
-            COMPREPLY=( $(compgen -W "$cmds" -- "$cur") )
-            return 0
-        fi
-    elif [[ "${COMP_WORDS[@]}" =~ ".* --host .*" ]]; then
-        if [[ "$prev" == --host ]]; then
-            _known_hosts
-        elif [[ $COMP_CWORD -lt 4 ]]; then
-            COMPREPLY=( $(compgen -W "--passwd $cmds" -- "$cur") )
-            return 0
-        fi
+    else
+        if [[ "${COMP_WORDS[@]}" =~ ".* --host .* --passwd .*" ]]; then
+            if [[ $COMP_CWORD -eq 5 ]]; then
+                COMPREPLY=( $(compgen -W "$cmds" -- "$cur") )
+            fi
+        elif [[ "${COMP_WORDS[@]}" =~ ".* --passwd .*" ]]; then
+            if [[ $COMP_CWORD -eq 3 ]]; then
+                COMPREPLY=( $(compgen -W "$cmds" -- "$cur") )
+            fi
+        elif [[ "${COMP_WORDS[@]}" =~ ".* --host .*" ]]; then
+            if [[ $COMP_CWORD -eq 3 ]]; then
+                COMPREPLY=( $(compgen -W "--passwd $cmds" -- "$cur") )
+            fi
+       fi
     fi
 
-    # complete single commands
+    # Handle options/commands that require one or more arguments.
     case "$prev" in
+        --get_messages|--passwd)
+            return 0
+        ;;
+
+        --host)
+            _known_hosts
+            return 0
+        ;;
+
         --set_run_mode|--set_network_mode)
             COMPREPLY=( $(compgen -W "always auto never" -- "$cur") )
             return 0




More information about the pkg-boinc-commits mailing list