File tree Expand file tree Collapse file tree 4 files changed +26
-15
lines changed Expand file tree Collapse file tree 4 files changed +26
-15
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ export DOT_FILES_PATH=$(dirname $(readlink ~/.zshrc))
3
3
export DOT_DOT_PATH=" ${DOT_FILES_PATH} /dot"
4
4
export DOT_TOOLS_PATH=" ${DOT_FILES_PATH} /tools"
5
5
6
+ source " ${DOT_FILES_PATH} /dot/common.sh"
6
7
source " ${DOT_FILES_PATH} /dot/load.sh"
7
8
8
9
# workspaces is either in ~/Projects or in codespaces it's in /codespaces
@@ -23,10 +24,6 @@ PROMPT='%(?.%F{green}√.%F{red}?%?)%f %B%F{250}%1~%f%b %(!.#.$) '
23
24
24
25
dot_load
25
26
dot_help
26
-
27
- # "${DOT_FILES_PATH}/dot/tools.sh" "init"
28
- # dot_load_tools
29
- # echo
30
27
dot_tools " init"
31
28
32
29
# codespaces automatically takes you into that repo.
Original file line number Diff line number Diff line change @@ -19,6 +19,17 @@ popd () {
19
19
command popd " $@ " > /dev/null
20
20
}
21
21
22
+ # https://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there
23
+ pathappend () {
24
+ for ARG in " $@ "
25
+ do
26
+ if [ -d " $ARG " ] && [[ " :$PATH :" != * " :$ARG :" * ]]; then
27
+ echo " appending path ${ARG} "
28
+ PATH=" ${PATH: +" $PATH :" } $ARG "
29
+ fi
30
+ done
31
+ }
32
+
22
33
cprint () {
23
34
# https://stackoverflow.com/a/64824268/775184
24
35
intense=' 1'
Original file line number Diff line number Diff line change @@ -30,7 +30,9 @@ dot_tools() {
30
30
" dot_tools_$cmd " " $@ "
31
31
32
32
# reload tools env and paths
33
- dot_tools_init
33
+ if [ " $cmd " != " init" ]; then
34
+ dot_tools_init
35
+ fi
34
36
else
35
37
dot_tools_ls
36
38
fi
Original file line number Diff line number Diff line change 2
2
export TOOL_GO_PATH="/usr/local/go/bin"
3
3
export TOOL_GO_BIN="$HOME/go/bin"
4
4
5
- init() {
6
- if [ -d ${TOOL_GO_PATH} ]; then
7
- if [ ! -x "$(command -v go)" ]; then
8
- echo "Adding go to PATH"
9
- export PATH=$PATH:${TOOL_GO_PATH}
10
- fi
5
+ if [ -d ${TOOL_GO_PATH} ]; then
6
+ # -x tests for execute permission and exists
7
+ if [ ! -x "$(command -v go)" ]; then
8
+ echo "Adding go to PATH"
9
+ pathappend "${TOOL_GO_PATH}"
10
+ # export PATH=$PATH:${TOOL_GO_PATH}
11
+ fi
11
12
12
- if [ -d ${TOOL_GO_BIN} ]; then
13
- export PATH=$PATH:$ {TOOL_GO_BIN}
14
- fi
13
+ if [ -d " ${TOOL_GO_BIN}" ]; then
14
+ pathappend "$ {TOOL_GO_BIN}"
15
+ # export PATH=$PATH:${TOOL_GO_BIN}
15
16
fi
16
- }
17
+ fi
You can’t perform that action at this time.
0 commit comments