From aa457cb9196c0be47dd06c2f322665f8b5920cdd Mon Sep 17 00:00:00 2001 From: Bram Crielaard Date: Tue, 12 Sep 2017 17:55:54 +0200 Subject: [PATCH 1/6] Update version --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index 13e69e9..612f580 100644 --- a/version +++ b/version @@ -1 +1 @@ -Workman version 1.2.4 +Workman version 1.3 From 4a7623804c32c5b6fe255e9503848dafc7d8e9b9 Mon Sep 17 00:00:00 2001 From: Bram Crielaard Date: Tue, 12 Sep 2017 17:57:11 +0200 Subject: [PATCH 2/6] Update help --- help | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/help b/help index 7901617..f4b45de 100644 --- a/help +++ b/help @@ -20,6 +20,10 @@ VERSION workspace --version display version workspace -v +FINDING +workspace --which show workspace directory +workspace -w + SWITCHING workspace [name] go to workspace [name] workspace go to last used workspace From 607b5bad86db51907cbc9d49f1bbc91d9a5f0ace Mon Sep 17 00:00:00 2001 From: Bram Crielaard Date: Tue, 12 Sep 2017 17:57:43 +0200 Subject: [PATCH 3/6] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 26066e5..3891db5 100644 --- a/README.md +++ b/README.md @@ -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. From e14183245d77d78e8ff87d02b7ed855b094fe1d7 Mon Sep 17 00:00:00 2001 From: Bram Crielaard Date: Tue, 12 Sep 2017 17:58:08 +0200 Subject: [PATCH 4/6] Update workspace.sh --- workspace.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/workspace.sh b/workspace.sh index 80875af..5ce4c85 100755 --- a/workspace.sh +++ b/workspace.sh @@ -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 @@ -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) From b0bb0ae501f2e13a1d9aec249637e7a23b321fc4 Mon Sep 17 00:00:00 2001 From: Bram Crielaard Date: Tue, 12 Sep 2017 17:58:39 +0200 Subject: [PATCH 5/6] Update _workspace --- workspace/_workspace | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/workspace/_workspace b/workspace/_workspace index b43f854..8319a97 100644 --- a/workspace/_workspace +++ b/workspace/_workspace @@ -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 From 98c315010e0d088e313e4b479b50da393f3b07a0 Mon Sep 17 00:00:00 2001 From: Bram Crielaard Date: Tue, 12 Sep 2017 18:00:47 +0200 Subject: [PATCH 6/6] Update help --- help | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/help b/help index f4b45de..1586365 100644 --- a/help +++ b/help @@ -21,8 +21,8 @@ workspace --version display version workspace -v FINDING -workspace --which show workspace directory -workspace -w +workspace --which [name] show workspace directory +workspace -w [name] SWITCHING workspace [name] go to workspace [name]