Skip to content

Commit

Permalink
Merge pull request #5 from Geweldig/version1_3
Browse files Browse the repository at this point in the history
Version 1.3
  • Loading branch information
Geweldig authored Sep 12, 2017
2 parents aa153e7 + 98c3150 commit 6196512
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ If you have oh-my-zsh you can use the auto-complete plugin. This plugin is autom
- `workspace -a/--add NAME`: Adds the current directory as a workspace with the name NAME.
- `workspace -d/--delete NAME`: Removes the workspace with the name NAME.
- `workspace -l/--list`: List all workspaces.
- `workspace -w/--which NAME`: Show workspace directory.
- `workspace -h/--help`: Display the help.
- `workspace -v/--version`: Display the version.
- `workspace NAME`: Go to workspace NAME.
Expand Down
4 changes: 4 additions & 0 deletions help
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ VERSION
workspace --version display version
workspace -v

FINDING
workspace --which [name] show workspace directory
workspace -w [name]

SWITCHING
workspace [name] go to workspace [name]
workspace go to last used workspace
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Workman version 1.2.4
Workman version 1.3
21 changes: 21 additions & 0 deletions workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ function workspace() {
cat "$DIR/version"
EXITCODE=0
}

__workspaceman_which() {
if [[ -f $DIR/.$1 ]]; then
cat $DIR/.$1
EXITCODE=0
else
EXITCODE=1
fi
}

# Handle flags, getops breaks for functions
if [[ ! -z "$1" ]] && [[ $1 =~ ^- ]]; then
Expand Down Expand Up @@ -86,6 +95,18 @@ function workspace() {
return $EXITCODE
fi
return $EXITCODE

# Handle -w/--which flag
elif [[ "$1" = "-w" ]] || [[ "$1" = "--which" ]]; then
# Second parameter is required
if [[ ! -z "$2" ]]; then
__workspaceman_which $2
else
echo "A name is required when checking a workspace directory."
EXITCODE=1
return $EXITCODE
fi
return $EXITCODE
fi

# Handle all other commands (i.e, switching directory)
Expand Down
4 changes: 3 additions & 1 deletion workspace/_workspace
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ function _workspace() {
- set4 \
'--list[list workspaces]' \
- set5 \
'--help[show help]' \
'--which[show workspace directory]:workspace:->listspaces' \
- set6 \
'--help[show help]' \
- set7 \
'--version[show version]'

case "$state" in
Expand Down

0 comments on commit 6196512

Please sign in to comment.