Skip to content

Commit 8e2d364

Browse files
committedSep 11, 2009
Changed show_workit_projects() to show only directories and ignore
files. In workit(), added two new env vars; $PROJ_NAME to replace $project, and $PROJ_PATH. Felt this eased some repetitive pain in the postde/active scripts and made it slightly more uniform with the naming. Added zmysql_start() to process_functions.sh.
1 parent dbd0e85 commit 8e2d364

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed
 

‎process_functions.sh

+22
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,28 @@ function zpgsql_start () {
9797
return 1
9898
}
9999

100+
function zmysql_start () {
101+
zprocess_running 'mysqld'
102+
started="$?"
103+
104+
if [ $started -eq 0 ]; then
105+
eval "$MYSQL_START"
106+
else
107+
echo "MySQL Running"
108+
return 1
109+
fi
110+
111+
# make sure that it's running
112+
zprocess_running 'mysqld'
113+
started="$?"
114+
if [ $started -eq 0 ]; then
115+
echo "Could not start MySQL"
116+
return 0
117+
fi
118+
119+
return 1
120+
}
121+
100122
# ctags
101123
function zctags () {
102124

‎workit.sh

+7-5
Original file line numberDiff line numberDiff line change
@@ -109,25 +109,27 @@ function show_workit_projects () {
109109
verify_workit_home || return 1
110110
# NOTE: DO NOT use ls here because colorized versions spew control characters
111111
# into the output list.
112-
(cd "$WORKIT_HOME"; for f in *; do echo $f; done) | sed 's|^\./||' | sort
112+
(cd "$WORKIT_HOME"; for f in *; do [[ -d $f ]] && echo $f; done) | sed 's|^\./||' | sort
113113
}
114114

115115
# List or change workit projects
116116
#
117117
# Usage: workit [environment_name]
118118
#
119119
function workit () {
120-
typeset project="$1"
121-
if [ "$project" = "" ]
120+
typeset PROJ_NAME="$1"
121+
typeset PROJ_PATH="$WORKIT_HOME/$PROJ_NAME"
122+
123+
if [ "$PROJ_NAME" = "" ]
122124
then
123125
show_workit_projects
124126
return 1
125127
fi
126128

127129
verify_workit_home || return 1
128-
verify_workit_project $project || return 1
130+
verify_workit_project $PROJ_NAME || return 1
129131

130-
cd "$WORKIT_HOME/$project"
132+
cd $PROJ_PATH
131133

132134
# Deactivate any current environment "destructively"
133135
# before switching so we use our override function,

0 commit comments

Comments
 (0)
Please sign in to comment.