-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopen-create-projects.plugin.zsh
executable file
·40 lines (31 loc) · 1.07 KB
/
open-create-projects.plugin.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
my_php_projects_path="$HOME/Documents/vagrant_ubuntu12x32/public"
my_golang_projects_path="$HOME/Documents/go-workspace/src/github.com/marcossegovia"
open_create_projects() {
local -A projects_path
projects_path=(
php ${my_php_projects_path}
go ${my_golang_projects_path}
)
#(( $+{projects_path[$1]} )) || return 1
local directory="${projects_path[$1]}/$2"
if [[ -d "$directory" ]]; then
echo "Path '$directory' found, opening existing project..."
else
echo "Path '$directory' not found, creating new project..."
mkdir "$directory"
fi
case $1 in
php) /usr/local/bin/phpstorm $directory ;;
go) /usr/local/bin/Gogland $directory ;;
esac
}
_open_create_projects() {
local -A projects_path
projects_path=(
php ${my_php_projects_path}
go ${my_golang_projects_path}
)
_arguments ':code platform:(php go)' \
'*:project:_files -/ -W $projects_path[${words[2]}]'
}
compdef _open_create_projects open_create_projects