File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -11,19 +11,23 @@ function show_contents {
1111 fi
1212}
1313
14+ function global_ignore() {
15+ git config --global core.excludesfile || echo " $XDG_CONFIG_HOME /git/ignore" || echo " $HOME /.config/git/ignore"
16+ }
17+
1418function show_global {
15- show_contents Global ` git config --global core.excludesfile `
19+ show_contents Global " $( global_ignore ) "
1620}
1721
1822function add_global {
19- local global_gitignore=$( git config --global core.excludesfile )
23+ local global_gitignore=" $( global_ignore ) "
2024 if [ -z " $global_gitignore " ]; then
2125 echo " Can't find global .gitignore."
2226 echo " "
2327 echo " Use 'git config --global --add core.excludesfile ~/.gitignore-global' to set the path to your global gitignore file to '~/.gitignore-global'."
2428 echo " "
2529 else
26- add_patterns ` git config --global core.excludesfile ` " $@ "
30+ add_patterns " $global_gitignore " " $@ "
2731 fi
2832}
2933
Original file line number Diff line number Diff line change 22
33gitignore_io_url=" https://www.gitignore.io/api/"
44default_path=" $HOME /.gi_list"
5+ if [[ -n " $XDG_CACHE_HOME " ]]; then
6+ default_path=" $XDG_CACHE_HOME /git-extras/gi_list"
7+ mkdir -p " $XDG_CACHE_HOME /git-extras"
8+ fi
59
610update_gi_list () {
7- curl -L -s " ${gitignore_io_url} /list" > ~ /.gi_list
11+ curl -L -s " ${gitignore_io_url} /list" > " $default_path "
812}
913
1014print_in_alphabetical_order () {
@@ -73,8 +77,8 @@ show_usage() {
7377 echo " [-l|--list-in-table] Print available types in table format"
7478 echo " [-L|--list-alphabetically] Print available types in alphabetical order "
7579 echo " [-s|--search] <word> Search word in available types"
76- echo " [-t|--show-update-time] Show the last modified time of ~/.gi_list (where the list of available types is stored)"
77- echo " [-u|--update-list] Update ~/.gi_list "
80+ echo " [-t|--show-update-time] Show the last modified time of $default_path (where the list of available types is stored)"
81+ echo " [-u|--update-list] Update $default_path "
7882}
7983
8084
You can’t perform that action at this time.
0 commit comments