Skip to content

Commit dea4146

Browse files
committed
Added locations script to EasyKey.bash
1 parent 124a69f commit dea4146

File tree

3 files changed

+45
-9
lines changed

3 files changed

+45
-9
lines changed

EasyKey.bash/ezk-locations.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
unset locations
4+
5+
script_dir="$1"
6+
source "${script_dir}/shellmenu.sh"
7+
8+
configfilename=.ezk-git-loca-conf
9+
10+
function toDirAndTerminate () {
11+
vars="$*" # all splitted words back to one var
12+
blueLog "toDir $vars"
13+
eval "cd ${vars// /\\ }" # escape spaces
14+
nowaitonexit
15+
}
16+
17+
# Reads the config into global array "workspaces"
18+
# The config needs to have that section [workspaces]
19+
initConfig "${script_dir}/EasyKey.git/${configfilename}"
20+
21+
echo "${locations[@]}"
22+
23+
clear
24+
thekeys=($(echo {a..p}) $(echo {r..z}) $(echo {1..9}) $(echo {A..Z}))
25+
declare -x keycounter=1
26+
27+
immediateMode=true
28+
29+
menuInit "Quick Locations"
30+
echo
31+
submenuHead "Registered locations:"
32+
OLD_IFS=$IFS
33+
for (( i = 1; i < (( ${#locations[@]} + 1 )); i++ )); do
34+
IFS="=" read -r locname locdestination <<< "${locations[i]}"
35+
menuItem "${thekeys[keycounter]}" "$locdestination" "toDirAndTerminate ${locdestination}"
36+
((keycounter++))
37+
done
38+
IFS=$OLD_IFS
39+
echo
40+
submenuHead "Shortcuts"
41+
menuItem X "Purge git dir cache" purgDirCache
42+
choice
43+
44+
unset locations

EasyKey.git/ezk-locations.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

shellmenu.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ wait_for_keypress() {
652652
initConfig () {
653653
# read config to global arrays
654654
INPUT="$1"
655-
[ ! -f "$INPUT" ] && { echo "$INPUT file not found"; exit 99; }
655+
[ ! -f "$INPUT" ] && { echo "Config file not found: $INPUT"; wait_for_keypress; }
656656
i=0
657657
configlines=$(cat "$INPUT")
658658
while read -r configline; do

0 commit comments

Comments
 (0)