File tree Expand file tree Collapse file tree 3 files changed +37
-24
lines changed
Expand file tree Collapse file tree 3 files changed +37
-24
lines changed Original file line number Diff line number Diff line change @@ -287,6 +287,7 @@ function atlassiansView() {
287287
288288function changeProject () {
289289 source $script_dir /../EasyKey.git/ezk-git-loca.sh
290+ noterminate
290291 nowaitonexit
291292}
292293
Original file line number Diff line number Diff line change @@ -19,27 +19,9 @@ 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} +=('$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}) )
7961if $uncached ; then coloredLog " NEW" " 1;42" ; else coloredLog " CACHED" " 1;42" ; fi
8062submenuHead " Shortcuts"
8163menuItem X " Purge git dir cache" purgDirCache
82- echo
83- menuItem q " Quit" quit
8464choice
8565
8666unset locations workspaces
Original file line number Diff line number Diff line change @@ -635,4 +635,36 @@ wait_for_keypress() {
635635 stty raw
636636 REPLY=$( dd bs=1 count=1 2> /dev/null)
637637 stty -raw
638- }
638+ }
639+
640+ # #####################################################
641+ # A magic function that reads a file with sections
642+ # into global arrays named by this section.
643+ # Sections in the file start with [<section name>].
644+ # After that section heading the config lines follow.
645+ # A new section begins with [<new section name>].
646+ # Arguments:
647+ # $1: the config filename to read
648+ # Outputs:
649+ # Global arrays that have the name of the sections
650+ # in the config file.
651+ # #####################################################
652+ initConfig () {
653+ # read config to global arrays
654+ INPUT=" $1 "
655+ [ ! -f " $INPUT " ] && { echo " $INPUT file not found" ; exit 99; }
656+ i=0
657+ configlines=$( cat " $INPUT " )
658+ while read -r configline; do
659+ if echo " $configline " | grep -q " \[.*\]" ; then
660+ configsection=$( echo " $configline " | grep -o " \[.*\]" )
661+ configsectioname=${configsection: 1: ${# configsection} -2}
662+ i=0
663+ continue
664+ fi
665+ if [ -n " $configline " ]; then
666+ eval " ${configsectioname} +=('$configline ')"
667+ fi
668+ (( i++ ))
669+ done <<< " $(echo -e " $configlines " )"
670+ }
You can’t perform that action at this time.
0 commit comments