]> id.pley.net Git - dotfiles.git/commitdiff
Added 'switchto' command
authorJer Noble <jer.noble@apple.com>
Thu, 31 May 2012 19:45:07 +0000 (12:45 -0700)
committerJer Noble <jer.noble@apple.com>
Thu, 31 May 2012 19:45:07 +0000 (12:45 -0700)
.webkit_login

index 477be0c6d9ab257daf24a8b01e87cd9b9be6fccf..d99772ae27eb6a43ff6469b29d3ac989b8fa6f70 100644 (file)
@@ -1,10 +1,20 @@
 #!/bin/bash
 
-export WEBKIT_DIR=~/Projects/WebKit.PuzzleBox
-if [[ -f ${WEBKIT_DIR}/webkitenv ]]; then
-    source ${WEBKIT_DIR}/webkitenv
-fi
-
 function switchto() {
-    source ~/Projects/WebKit.$1/webkitenv
+    export WEBKIT_DIR=~/Projects/WebKit.$1
+    if [[ -f ${WEBKIT_DIR}/webkitenv ]]; then
+        source ${WEBKIT_DIR}/webkitenv
+    fi
+}
+
+function _switchto_complete() {
+    COMPREPLY=()
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    opts=$( for dir in ~/Projects/WebKit.*; do echo ${dir##*.}; done )
+    COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+    return 0
 }
+
+complete -F _switchto_complete switchto
+
+switchto PuzzleBox
\ No newline at end of file