[24205] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r23806 - in trunk/athena/bin/athrun: . debian

daemon@ATHENA.MIT.EDU (Anders Kaseorg)
Mon May 18 18:47:50 2009

X-Barracuda-Envelope-From: andersk@mit.edu
Date: Mon, 18 May 2009 18:47:44 -0400
From: Anders Kaseorg <andersk@MIT.EDU>
Message-Id: <200905182247.n4IMliaW018341@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: andersk
Date: 2009-05-18 18:47:44 -0400 (Mon, 18 May 2009)
New Revision: 23806

Modified:
   trunk/athena/bin/athrun/bash_completion
   trunk/athena/bin/athrun/debian/changelog
Log:
In athrun:
  [ Evan Broder ]
  [ Anders Kaseorg ]
  * Better bash completion.


Modified: trunk/athena/bin/athrun/bash_completion
===================================================================
--- trunk/athena/bin/athrun/bash_completion	2009-05-18 22:27:17 UTC (rev 23805)
+++ trunk/athena/bin/athrun/bash_completion	2009-05-18 22:47:44 UTC (rev 23806)
@@ -1,19 +1,17 @@
 _athrun () {
-    local cur
-    local opts
     COMPREPLY=()
-    prev="${COMP_WORDS[COMP_CWORD-1]}"
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    if [ $COMP_CWORD -lt 3 ]; then
-        case $COMP_CWORD in
-            1)
-                opts="$(ls /mit)"
-                ;;
-            2)
-                opts="$(ls "$(athdir "/mit/$prev" bin)")"
-                ;;
-        esac
-        COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
+    local cur="${COMP_WORDS[$COMP_CWORD]}"
+
+    if [ $COMP_CWORD -eq 1 ]; then
+	local IFS=$'\n'
+	COMPREPLY=( $(cd /mit && compgen -f -- "$cur") )
+    elif [ $COMP_CWORD -eq 2 ]; then
+	local IFS=$'\n'
+	COMPREPLY=( $(dir="$(eval "athdir /mit/${COMP_WORDS[1]}")" && \
+	    cd "$dir" && compgen -f -- "$cur") )
+    else
+	COMP_WORDS[1]=-dummy
+	_command
     fi
 }
-complete -F _athrun athrun
+complete -F _athrun $filenames athrun

Modified: trunk/athena/bin/athrun/debian/changelog
===================================================================
--- trunk/athena/bin/athrun/debian/changelog	2009-05-18 22:27:17 UTC (rev 23805)
+++ trunk/athena/bin/athrun/debian/changelog	2009-05-18 22:47:44 UTC (rev 23806)
@@ -1,9 +1,13 @@
 debathena-athrun (10.0.1-0debathena1) unstable; urgency=low
 
+  [ Evan Broder ]
   * Add bash tab completion for athrun. (Trac: #150)
 
- -- Evan Broder <broder@mit.edu>  Mon, 18 May 2009 16:34:00 -0400
+  [ Anders Kaseorg ]
+  * Better bash completion.
 
+ -- Anders Kaseorg <andersk@mit.edu>  Mon, 18 May 2009 18:47:00 -0400
+
 debathena-athrun (10.0.0-0debathena2) unstable; urgency=low
 
   * Change DEB_AUTO_UPDATE_AUTOCONF to 2.50, not 1.


home help back first fref pref prev next nref lref last post