File tree Expand file tree Collapse file tree 7 files changed +27
-15
lines changed
fzf_previews/custom-git-explorer Expand file tree Collapse file tree 7 files changed +27
-15
lines changed Original file line number Diff line number Diff line change 1
1
ask
2
+ custom-git-explorer
2
3
gadd
3
4
gbranchcreate
4
5
gcommit
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ function get_verb() {
30
30
--info=hidden\
31
31
--preview " source $__CUSTOM_GIT_UTIL /fzf_previews/custom-git-explorer/__verb_preview;
32
32
__verb_preview {}" ) "
33
- echo " ${verb} "
33
+ echo " ${verb/* . / } "
34
34
}
35
35
36
36
# Usage: get_noun "add"
@@ -39,13 +39,13 @@ function get_noun() {
39
39
local verb=" ${1} "
40
40
local NOUN_ARR=()
41
41
__get_nouns " ${verb} "
42
- local nounHeader=" $( __noun_header " ${verb/* . / } " ) "
42
+ local nounHeader=" $( __noun_header " ${verb} " ) "
43
43
local noun=" $( printf " %s\n" " ${NOUN_ARR[@]} " | \
44
44
fzf --height=10% --preview-window right:65%\
45
45
--header " ${nounHeader} " \
46
46
--info=hidden\
47
47
--bind " enter:ignore" \
48
- --bind " ctrl-d:execute-silent (source $__CUSTOM_GIT_UTIL /custom-git-explorer/__open_web_page; __open_web_page ${verb} {} &)" \
48
+ --bind " ctrl-d:execute(source $__CUSTOM_GIT_UTIL /custom-git-explorer/__open_web_page; __open_web_page ${verb} {} &)" \
49
49
--preview " source $__CUSTOM_GIT_UTIL /fzf_previews/custom-git-explorer/__noun_preview;
50
50
__noun_preview ${verb/* . / } {}" ) "
51
51
echo " ${noun} "
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ function __isgitrepo() {
4
+
5
+ if git rev-parse --git-dir > /dev/null 2>&1 ; then
6
+ # This is a valid git repository.
7
+ echo true
8
+ else
9
+ echo false
10
+ fi
11
+ }
Original file line number Diff line number Diff line change @@ -10,17 +10,17 @@ function __get_nouns() {
10
10
11
11
local verb=" ${1} "
12
12
case " ${verb} " in
13
- " 1. show/view" )
13
+ " show/view" )
14
14
NOUN_ARR=(" 1. status" " 2. uncommitted changes" " 3. commit logs/history" )
15
15
;;
16
- " 2. add" )
16
+ " add" )
17
17
NOUN_ARR=(" 1. new changes" )
18
18
;;
19
- " 3. restore" )
19
+ " restore" )
20
20
NOUN_ARR=(" 1. staged changes" " 2. unstaged changes" )
21
21
;;
22
22
* )
23
- __print_err " [__noun_preview] verb: ${verb} , noun: unknown "
23
+ __print_err " [__get_nouns] unknown verb: ${verb} "
24
24
;;
25
25
esac
26
26
}
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ function __get_url() {
24
24
url=" https://bhavidhingra.github.io/just-my-docs/explorer/show/commit-logs"
25
25
;;
26
26
* )
27
- __print_err " [__get_url] verb: ${verb} , noun: unknown "
27
+ __print_err " [__get_url] verb: ${verb} , unknown noun: ${noun} "
28
28
;;
29
29
esac
30
30
;;
@@ -34,7 +34,7 @@ function __get_url() {
34
34
url=" https://bhavidhingra.github.io/just-my-docs/explorer/add/new-changes"
35
35
;;
36
36
* )
37
- __print_err " [__get_url] verb: ${verb} , noun: unknown "
37
+ __print_err " [__get_url] verb: ${verb} , unknown noun: ${noun} "
38
38
;;
39
39
esac
40
40
;;
@@ -47,12 +47,12 @@ function __get_url() {
47
47
url=" https://bhavidhingra.github.io/just-my-docs/explorer/restore/unstaged-changes"
48
48
;;
49
49
* )
50
- __print_err " [__get_url] verb: ${verb} , noun: unknown "
50
+ __print_err " [__get_url] verb: ${verb} , unknown noun: ${noun} "
51
51
;;
52
52
esac
53
53
;;
54
54
* )
55
- __print_err " [__get_url] unknown verb"
55
+ __print_err " [__get_url] unknown verb: ${verb} "
56
56
;;
57
57
esac
58
58
Original file line number Diff line number Diff line change 5
5
6
6
source " $__CUSTOM_GIT_UTIL " /custom-git-explorer/__get_url
7
7
8
- # Usage: __open_web_page "add" "new changes"
8
+ # Usage: __open_web_page "add" "1. new changes"
9
9
function __open_web_page() {
10
10
11
11
local verb=" ${1} "
12
- local noun=" ${2} "
12
+ local noun=" ${2/* . / } "
13
13
local url=" $( __get_url " ${verb} " " ${noun} " ) "
14
14
[ -z " ${url} " ] && return
15
15
Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ source "${__CUSTOM_CONSOLE_UTIL}"/__println_as
8
8
# Usage: __verb_preview "add"
9
9
function __verb_preview() {
10
10
11
- local verb=" ${1} "
11
+ local verb=" ${1/* . / } "
12
12
local NOUN_ARR=()
13
13
__get_nouns " ${verb} "
14
- __println_as bold " ${verb/* . / } :- "
14
+ __println_as bold " ${verb} :- "
15
15
echo
16
16
printf " %s\n" " ${NOUN_ARR[@]} "
17
17
}
You can’t perform that action at this time.
0 commit comments