aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xgist7
1 files changed, 4 insertions, 3 deletions
diff --git a/gist b/gist
index a405245..96231b9 100755
--- a/gist
+++ b/gist
@@ -18,7 +18,7 @@
18# edit, e <index_of_gist> Edit a gist's description 18# edit, e <index_of_gist> Edit a gist's description
19# delete, D <index_of_gist>... Delete a gist 19# delete, D <index_of_gist>... Delete a gist
20# clean, C Clean removed gists in local 20# clean, C Clean removed gists in local
21# config, c [token | user | folder | auto_sync | EDITOR | action | protocol [value] ] Do configuration 21# config, c [token | user | folder | auto_sync | EDITOR | action | protocol <value> ] Do configuration
22# user, U <user> Get gists from a given Github user 22# user, U <user> Get gists from a given Github user
23# grep, g <pattern> Grep gists by a given pattern 23# grep, g <pattern> Grep gists by a given pattern
24# push, p <index_of_gist> Push changes by git (well, better to make commit by youself) 24# push, p <index_of_gist> Push changes by git (well, better to make commit by youself)
@@ -43,7 +43,6 @@ configuredClient=""
43GITHUB_API=https://api.github.com 43GITHUB_API=https://api.github.com
44CONFIG=~/.config/gist.conf; mkdir -p ~/.config 44CONFIG=~/.config/gist.conf; mkdir -p ~/.config
45 45
46folder=~/gist && mkdir -p $folder
47action="${EDITOR:-vi} ." 46action="${EDITOR:-vi} ."
48[[ -z $hint ]] && hint=true # default to show hint with list of gist 47[[ -z $hint ]] && hint=true # default to show hint with list of gist
49[[ -z $confirm ]] && confirm=true # default to confirm when deleting gists 48[[ -z $confirm ]] && confirm=true # default to confirm when deleting gists
@@ -225,6 +224,8 @@ _validate_config(){
225# load configuration 224# load configuration
226_apply_config() { 225_apply_config() {
227 _validate_config "$@" || return 1 226 _validate_config "$@" || return 1
227
228 [[ -z $folder ]] && folder=~/gist; mkdir -p $folder
228 INDEX=$folder/index; [[ -e $INDEX ]] || touch $INDEX 229 INDEX=$folder/index; [[ -e $INDEX ]] || touch $INDEX
229} 230}
230 231
@@ -328,7 +329,7 @@ _fetch_gists() {
328 local route="users/$user/gists" 329 local route="users/$user/gists"
329 local filter='/^[^s]/ d; /^$/ d' 330 local filter='/^[^s]/ d; /^$/ d'
330 if [[ $1 =~ ^(star|s)$ ]];then 331 if [[ $1 =~ ^(star|s)$ ]];then
331 route="gists/starred" 332 route='gists/starred'
332 local mark="s" 333 local mark="s"
333 filter='/^[s]/ d; /^$/ d' 334 filter='/^[s]/ d; /^$/ d'
334 fi 335 fi