-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdmenu_tgit
More file actions
executable file
·46 lines (38 loc) · 1023 Bytes
/
dmenu_tgit
File metadata and controls
executable file
·46 lines (38 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
main_prompt="Repositories"
git_options="open\nstatus\ndiff\ncheckout"
branches_menu(){
branches="$(cd $path && git branch -r)"
branch=$(echo -e "$branches" | dmenu -i -p Checkout:)
x-terminal-emulator -e 'sh -c "cd '$path' && git '$option $branch'; $SHELL"'
}
options_menu(){
[[ -n $repo ]] || return 1
path="$HOME/$repo"
prompt="$(tgit_status $path) $repo"
option=$(echo -e "$git_options" | dmenu -i -p "$prompt:")
[[ -n $option ]] || return 1
case "$option" in
"checkout")
# branches_menu
;;
"open")
codium $path
;;
*)
x-terminal-emulator -e 'sh -c "cd '$path' && git '$option'; $SHELL"'
;;
esac
return 0
}
repos_menu(){
repo=""
repo=$(echo -e ">> UPDATE\n$(tgit)" | dmenu -i -p "$main_prompt": | awk '{print $2}')
[[ -n $repo ]] || exit
[[ $repo == "UPDATE" ]] && tgit -u && return 1
return 0
}
while true; do
repos_menu && break
done
options_menu