From ede54eb541ad5864402cc48bd9312049e5bb9b92 Mon Sep 17 00:00:00 2001 From: Jer Noble Date: Thu, 31 May 2012 12:45:07 -0700 Subject: [PATCH 1/1] Added 'switchto' command --- .webkit_login | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.webkit_login b/.webkit_login index 477be0c..d99772a 100644 --- a/.webkit_login +++ b/.webkit_login @@ -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 -- 2.40.1