-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-command.sh
50 lines (39 loc) · 1.19 KB
/
create-command.sh
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
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
__autocomplection_workspace() {
if [ -z "$WORKSPACE_PATH" ]; then
WORKSPACE_PATH="$HOME/Work"
fi
command_named=$1
current_word_called=$2
word_before_called=$3
if [ "${#COMP_WORDS[@]}" = "2" ]; then
COMPREPLY=($(compgen -W "init i cd go path help --help -h" "${current_word_called}"))
elif [ "${#COMP_WORDS[@]}" = "3" ]; then
case $word_before_called in
cd | go | path ) COMPREPLY=($(compgen -W "`ls $WORKSPACE_PATH 2> /dev/null`" "${current_word_called}")) ;;
help ) COMPREPLY=($(compgen -W "init i cd go" "${current_word_called}")) ;;
esac
elif [ "${#COMP_WORDS[@]}" = "4" ]; then
case "${COMP_WORDS[1]}" in
cd | go ) COMPREPLY=($(compgen -W "`ls "$WORKSPACE_PATH/$word_before_called" 2> /dev/null`" "${current_word_called}")) ;;
esac
fi
return 0
}
#
# __wrokspace() {
# case $1 in
# init | i | cd | go | rmEnv | addEnv) eval `workspace $@` ;;
# *) workspace $@
# esac
# }
# eval `workspace create-command wrk $HOME/Work`
# #
# alias wrk="WORKSPACE_PATH='$HOME/Work' workspace"
#
# ####
#
# eval `workspace create-command -n proy -p $HOME/Work`
# #
# alias wrk="WORKSPACE_PATH='$HOME/Proyectos' workspace"
#