Skip to content

Commit 688cbe7

Browse files
authored
Merge pull request #8 from nschlimm/feature/menucache
Feature/menucache
2 parents c3eee92 + 009e983 commit 688cbe7

18 files changed

+263
-219
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
*launch.json
12
EasyKey.git/.ezk-git-loca-conf

EasyKey.bash/bashstuff.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ menuInit "EasyKey.bash"
3535
menuItem l "Largest directories" "du -hsx .[!.]* * | sort -rh | head -10"
3636
menuItem m "Largest files" "find . -type f -exec du -h {} + | sort -rh | head -n 10"
3737
menuItem n "Size of current directory" "du -sh ."
38-
startMenu "$(pwd)"
38+
startMenu "pwd"

EasyKey.bash/ezk-locations.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,29 @@ function toDirAndTerminate () {
1212
blueLog "toDir $vars"
1313
eval "cd ${vars// /\\ }" # escape spaces
1414
nowaitonexit
15+
terminate
1516
}
1617

1718
# Reads the config into global array "workspaces"
1819
# The config needs to have that section [workspaces]
1920
initConfig "${script_dir}/EasyKey.bash/${configfilename}"
2021

21-
echo "${locations[@]}"
22-
2322
clear
2423
thekeys=($(echo {a..p}) $(echo {r..z}) $(echo {1..9}) $(echo {A..Z}))
2524
declare -x keycounter=1
2625

27-
immediateMode=true
28-
29-
menuInit "Quick Locations"
30-
echo
31-
submenuHead "Registered locations:"
26+
echo "Quick locations:"
3227
OLD_IFS=$IFS
3328
for (( i = 1; i < (( ${#locations[@]} + 1 )); i++ )); do
3429
IFS="=" read -r locname locdestination <<< "${locations[i]}"
3530
menuItem "${thekeys[keycounter]}" "$locdestination" "toDirAndTerminate ${locdestination}"
31+
echo "${thekeys[keycounter]}". "$locdestination"
3632
((keycounter++))
3733
done
3834
IFS=$OLD_IFS
39-
echo
4035
submenuHead "Shortcuts"
4136
menuItem X "Purge git dir cache" purgDirCache
4237
choice
4338

39+
source "${script_dir}/shellmenu.sh"
4440
unset locations

EasyKey.git/ezk-git-atis.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

3-
# all your menu actions here
3+
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
source "$script_dir/../shellmenu.sh"
5+
source "$script_dir/ezk-git-functions.sh"
46

57
function listAuthorCommits () {
68
executeCommand "git authors --list"
@@ -31,12 +33,9 @@ function oneCommit () {
3133
git diff $commit^ $commit --name-status
3234
}
3335

34-
while ${continuemenu:=true}; do
35-
clear
3636
menuInit "Inspecting repositories"
3737
submenuHead "State of working tree and stage (git status)"
3838
menuItem a "List which files are staged, unstaged, and untracked" "git status -s"
39-
echo
4039
submenuHead "Information regarding the committed project history (git log)"
4140
menuItem b "Display commit history in one line" "git log --oneline"
4241
menuItem c "Show which files were altered in commits" "git log --stat"
@@ -45,7 +44,5 @@ menuItem e "Search for commits by a particular author" listAuthorCommits
4544
menuItem f "Only display commits that include the specified file" listFileCommits
4645
menuItem g "Display a full diff of all the changes someone has made to a file" authorDiffFile
4746
menuItem h "Display contents of one commit" oneCommit
48-
echo
49-
choice
50-
done
47+
startMenu
5148
noterminate

EasyKey.git/ezk-git-atln.sh

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

3-
# submenus
3+
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
source "$script_dir/../shellmenu.sh"
5+
source "$script_dir/ezk-git-functions.sh"
46

57
function savingChanges () {
6-
source $script_dir/../EasyKey.git/ezk-git-atsc.sh
8+
bash $script_dir/../EasyKey.git/ezk-git-atsc.sh
79
nowaitonexit
810
}
911

1012
function inspectingRepos () {
11-
source $script_dir/../EasyKey.git/ezk-git-atis.sh
13+
bash $script_dir/../EasyKey.git/ezk-git-atis.sh
1214
nowaitonexit
1315
}
1416

1517
function undoingChanges () {
16-
source $script_dir/../EasyKey.git/ezk-git-atuc.sh
18+
bash $script_dir/../EasyKey.git/ezk-git-atuc.sh
1719
nowaitonexit
1820
}
1921

2022
function mergeRebase () {
21-
source $script_dir/../EasyKey.git/ezk-git-reme.sh
23+
bash $script_dir/../EasyKey.git/ezk-git-reme.sh
2224
nowaitonexit
2325
}
2426

@@ -31,18 +33,15 @@ cherryPick() {
3133
git cherry-pick "$cname"
3234
}
3335

34-
while ${continuemenu:=true}; do
35-
clear
36+
atlnStatus() {
37+
echo "Atlassians view on GIT, https://de.atlassian.com/git/tutorials"
38+
}
39+
3640
menuInit "Atlassian's View"
37-
echo "Atlassians view on GIT, https://de.atlassian.com/git/tutorials"
38-
echo
3941
submenuHead "Working on your local repository"
4042
menuItem b "Saving changes" savingChanges
4143
menuItem c "Inspecting a repository" inspectingRepos
4244
menuItem d "Undoing changes" undoingChanges
4345
menuItem e "Cherry pick commit" cherryPick
44-
echo
45-
showStatus
46-
choice
47-
done
46+
startMenu "atlnStatus"
4847
noterminate

EasyKey.git/ezk-git-atsc.sh

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
#!/bin/sh
1+
#!/bin/bash
2+
3+
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
source "$script_dir/../shellmenu.sh"
5+
source "$script_dir/ezk-git-functions.sh"
26

37
function interStage () {
48
git add -p
@@ -131,47 +135,36 @@ function ignoreMenu () {
131135
nowaitonexit
132136
}
133137

134-
while ${continuemenu:=true}; do
135-
clear
136138
menuInit "Saving changes"
137139
submenuHead "Adding changes to stage:"
138140
menuItem a "Git add all gently" addAllGently
139141
menuItem b "Git interactive staging session" interactiveStage
140142
menuItem c "Git interactive staging detail session" interStage
141-
echo
142143
submenuHead "Commit changes:"
143144
menuItem d "Commit staged snapshot - vim (stage -> archive)" commitStagedSnapshot
144145
menuItem f "Commit all changes of tracked files - vim (tree -> stage -> archive)" commitChangesVim
145146
menuItem g "Commit all changes of tracked files - read (tree -> stage -> archive)" commitChanges
146-
echo
147147
submenuHead "Stash current changes:"
148148
menuItem h "Stash current changes" stash
149149
menuItem i "Reapply stash to current directory (pop - deletes stash)" stashPop
150150
menuItem j "Reapply stash to current directory (apply - leaves stash alive)" stashApply
151151
menuItem k "Stash current changes - include untracked" stashAllIncludeUntracked
152152
menuItem l "Stash current changes - include all untracked and ignored" stashAll
153-
echo
154153
submenuHead "Managing multiple stashes:"
155154
menuItem m "List stashes" stashList
156155
menuItem n "Stash with message" stashWithMessage
157156
menuItem o "Reapply stash to current directory from stash list (pop)" stashPopFromList
158157
menuItem p "Reapply stash to current directory from stash list (apply)" stashApplyFromList
159-
echo
160158
submenuHead "Clean up stashes:"
161159
menuItem r "Delete all stashes" stashDeleteAll
162160
menuItem s "Delete specific stash" stashDeleteSpecific
163-
echo
164161
submenuHead "Other stash stuff:"
165162
menuItem t "View summary of a stash (stash state vs. original parent commit)" stashSummary
166163
menuItem u "View diff of a stash (stash state vs. original parent commit)" stashDiff
167164
menuItem v "Stash single files" stashSingle
168165
menuItem w "Create branch from stash" stashBranch
169166
menuItem x "Inspect stashes" inspectStash
170-
echo
171167
submenuHead "Ignoring files:"
172168
menuItem y "Ignore menu" ignoreMenu
173-
echo
174-
showStatus
175-
choice
176-
done
169+
startMenu
177170
noterminate

EasyKey.git/ezk-git-atsu.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
#!/bin/sh
1+
#!/bin/bash
2+
3+
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
source "$script_dir/../shellmenu.sh"
5+
source "$script_dir/ezk-git-functions.sh"
26

37
function atLocalGit () {
48

@@ -104,15 +108,12 @@ function adminAliases() {
104108
fi
105109
}
106110

107-
while ${continuemenu:=true}; do
108-
clear
109111
menuInit "Repositories"
110112
submenuHead "Setting up repositories"
111113
menuItem a "Transform the current directory into a git repository" atLocalGit
112114
menuItem b "Setting up a git repository in a directory" atLocalGitWithDir
113115
menuItem c "Setting up a shared git repository in a directory" atLocalGitBare
114116
menuItem d "Clone a remote repository" cloneRemote
115-
echo
116117
submenuHead "Configure repositories:"
117118
menuItem e "Define the author name and email to be used for all commits" defineAuthor
118119
menuItem f "Administering aliases" adminAliases
@@ -121,7 +122,6 @@ menuItem h "Define merge/diff tool" defineMergeTool
121122
menuItem i "Open global config" openGlobalConfig
122123
menuItem j "Open system config" openSystemConfig
123124
menuItem k "Open local config" openLocalConfig
124-
125-
choice
126-
done
125+
startMenu
126+
noterminate
127127
noterminate

EasyKey.git/ezk-git-diff.sh

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
#!/bin/sh
1+
#!/bin/bash
2+
3+
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
source "$script_dir/../shellmenu.sh"
5+
source "$script_dir/ezk-git-functions.sh"
26

37
function numberedList () {
48
kommando="$1"
@@ -81,34 +85,30 @@ function diffDate () {
8185
# alternative: git diff 'HEAD@{2017-03-03T00:00:00}' HEAD --name-status | nl
8286
}
8387

88+
diffStatus() {
89+
showStatus
90+
echo
91+
echo "Note: GIT diff cann compare four locations with each other: "
92+
echo " your working directory, the stage, the repository."
93+
echo
94+
coloredLog "┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐" "$clrPurple" "$clrBlack"
95+
coloredLog "│ │ │ │ │ │ │ │" "$clrPurple" "$clrBlack"
96+
coloredLog "│ │ -> │ │ -> │ │ -> │ │" "$clrPurple" "$clrBlack"
97+
coloredLog "└────────┘ └────────┘ └────────┘ └────────┘" "$clrPurple" "$clrBlack"
98+
coloredLog " work dir stage local repo remote repo" "$clrWhite" "$clrBlack"
99+
}
100+
84101
git fetch --all
85-
while ${continuemenu:=true}; do
86-
clear
87102
menuInit "Working with diffs"
88-
echo
89-
echo "Note: GIT diff cann compare four locations with each other: "
90-
echo " your working directory, the stage, the repository."
91-
echo
92-
coloredLog "┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐" "$clrPurple" "$clrBlack"
93-
coloredLog "│ │ │ │ │ │ │ │" "$clrPurple" "$clrBlack"
94-
coloredLog "│ │ -> │ │ -> │ │ -> │ │" "$clrPurple" "$clrBlack"
95-
coloredLog "└────────┘ └────────┘ └────────┘ └────────┘" "$clrPurple" "$clrBlack"
96-
coloredLog " work dir stage local repo remote repo" "$clrWhite" "$clrBlack"
97-
echo
98-
submenuHead "Different diff options:"
99-
menuItem a "actual branch vs. origin/actual branch. -> local repository vs. remote repository" headHead
100-
menuItem b "actual working dir vs. actual branch last commit -> work dir vs. local repository" dirHead
101-
menuItem c "actual working dir vs. other commits -> work dir vs. local repository" treeCommit
102-
menuItem d "commit vs. commit -> local repository vs. local repository" commitCommit
103-
menuItem e "branch vs. branch -> repository vs. repository (local/remote)" branchBranch
104-
echo
105-
submenuHead "Specific diffs:"
106-
menuItem k "Diff since date" diffDate
107-
echo
108-
submenuHead "Other usefull stuff here:"
109-
menuItem h "show commits" showCommits
110-
echo
111-
showStatus
112-
choice
113-
done
103+
submenuHead "Different diff options:"
104+
menuItem a "actual branch vs. origin/actual branch. -> local repository vs. remote repository" headHead
105+
menuItem b "actual working dir vs. actual branch last commit -> work dir vs. local repository" dirHead
106+
menuItem c "actual working dir vs. other commits -> work dir vs. local repository" treeCommit
107+
menuItem d "commit vs. commit -> local repository vs. local repository" commitCommit
108+
menuItem e "branch vs. branch -> repository vs. repository (local/remote)" branchBranch
109+
submenuHead "Specific diffs:"
110+
menuItem k "Diff since date" diffDate
111+
submenuHead "Other usefull stuff here:"
112+
menuItem h "show commits" showCommits
113+
startMenu "diffStatus"
114114
noterminate

EasyKey.git/ezk-git-extras.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
#!/bin/sh
1+
#!/bin/bash
2+
3+
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
source "$script_dir/../shellmenu.sh"
5+
source "$script_dir/ezk-git-functions.sh"
26

37
function changeBlame () {
48
git log --pretty=format:'%Cred%h%Creset | %Cgreen%ad%Creset | %s %C(yellow)%d%Creset %C(bold blue)[%an]%Creset %Cgreen(%cr)%Creset' --graph --date=short
@@ -38,8 +42,6 @@ function obliterate () {
3842

3943
}
4044

41-
while ${continuemenu:=true}; do
42-
clear
4345
menuInit "Git extras menu"
4446
submenuHead "Project information"
4547
menuItem a "Project summary in commits" "git summary"
@@ -50,17 +52,13 @@ menuItem e "Show information about the repo" "git info"
5052
menuItem f "Generate changelog" "git changelog -a"
5153
menuItem g "Show tree" "git show-tree"
5254
menuItem h "Show activity calendar" "git cal"
53-
echo
5455
submenuHead "Author information"
5556
menuItem k "List authors" "git authors --list"
5657
menuItem l "Find out what somebody did since ..." findOut
5758
menuItem m "Display change in blame between two revisions" changeBlame
58-
echo
5959
submenuHead "Effect repository actions"
6060
menuItem q "Remove latest commits and add their changes to stage" removeLatest
6161
menuItem r "Completely remove a file from the repository" obliterate
6262
menuItem s "Setup git repository in current dir" "git setup"
63-
echo
64-
choice
65-
done
63+
startMenu
6664
noterminate

EasyKey.git/ezk-git-functions.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,13 @@ function fetchAll () {
272272
# submenus
273273

274274
function workingDiffs() {
275-
source $script_dir/../EasyKey.git/ezk-git-diff.sh
275+
unset form
276+
bash $script_dir/../EasyKey.git/ezk-git-diff.sh
276277
nowaitonexit
277278
}
278279

279280
function atlassiansView() {
280-
source $script_dir/../EasyKey.git/ezk-git-atln.sh
281+
bash $script_dir/../EasyKey.git/ezk-git-atln.sh
281282
nowaitonexit
282283
}
283284

@@ -288,7 +289,7 @@ function changeProject () {
288289
}
289290

290291
function gitExtras () {
291-
source $script_dir/../EasyKey.git/ezk-git-extras.sh
292+
bash $script_dir/../EasyKey.git/ezk-git-extras.sh
292293
nowaitonexit
293294
}
294295

@@ -378,6 +379,6 @@ repoSize() {
378379
}
379380

380381
function settingUp () {
381-
source $script_dir/../EasyKey.git/ezk-git-atsu.sh
382+
bash $script_dir/../EasyKey.git/ezk-git-atsu.sh
382383
nowaitonexit
383384
}

0 commit comments

Comments
 (0)