@@ -19,53 +19,14 @@ function purgDirCache () {
1919 unset gitlocations
2020}
2121
22- initConfig () {
23- # read config to global arrays
24- INPUT=" $script_dir " /" $configfilename "
25- [ ! -f " $INPUT " ] && { echo " $INPUT file not found" ; exit 99; }
26- i=0
27- configlines=$( cat " $INPUT " )
28- while read -r configline; do
29- if echo " $configline " | grep -q " \[.*\]" ; then
30- configsection=$( echo " $configline " | grep -o " \[.*\]" )
31- configsectioname=${configsection: 1: ${# configsection} -2}
32- i=0
33- continue
34- fi
35- if [ -n " $configline " ]; then
36- eval " ${configsectioname[i]} ='$configline '"
37- fi
38- (( i++ ))
39- done <<< " $(echo -e " $configlines " )"
40- }
41-
42- initConfig
22+ # Reads the config into global array "workspaces"
23+ # The config needs to have that section [workspaces]
24+ initConfig " ${script_dir} /${configfilename} "
4325
4426clear
4527thekeys=($( echo {a..p}) $( echo {r..z}) $( echo {1..9}) $( echo {A..Z}) )
4628declare -x keycounter=0
47- menuInit " Favorite locations"
48- submenuHead " Locations:"
49- if [ -n ${locations+x} ]; then
50- for j in " ${locations[@]} "
51- do
52- locationname=$( echo " $j " | cut -f1 -d' =' )
53- locationdir=$( echo " $j " | cut -f2 -d' =' )
54- menuItem " ${thekeys[$keycounter]} " " $locationname " " toDirAndTerminate $locationdir "
55- (( keycounter++ ))
56- done
57- fi
58- echo
59- submenuHead " Workspaces:"
60- if [ -n ${workspaces+x} ]; then
61- for j in " ${workspaces[@]} "
62- do
63- locationname=$( echo " $j " | cut -f1 -d' =' )
64- locationdir=$( echo " $j " | cut -f2 -d' =' )
65- menuItem " ${thekeys[$keycounter]} " " $locationname " " toDir $locationdir "
66- (( keycounter++ ))
67- done
68- fi
29+ menuInit " GIT locations"
6930echo
7031uncached=false
7132priorlocation=$( pwd) # remember actual location
8849eval cd " ${priorlocation// / \\ } " # return to previous location
8950# print out git location cache
9051submenuHead " GIT repos inside workspaces:"
52+ echo
9153for (( i = 0 ; i < ${# gitlocations[@]} ; i++ )) ; do
9254 arrIN=(${gitlocations[$i]} )
9355 IFSOLD=$IFS
@@ -97,14 +59,8 @@ for (( i = 0; i < ${#gitlocations[@]}; i++ )); do
9759 menuItem " ${arrIN[0]} " " ${arrIN[1]} " " ${arrIN[2]} ${arrIN[3]} "
9860done
9961if $uncached ; then coloredLog " NEW" " 1;42" ; else coloredLog " CACHED" " 1;42" ; fi
100- echo
10162submenuHead " Shortcuts"
10263menuItem X " Purge git dir cache" purgDirCache
103- echo
104- menuItem q " Quit" quit
105- echo
106- coloredLog " $( pwd) " " 1;44"
107-
10864choice
10965
11066unset locations workspaces
0 commit comments