aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-02-06 14:55:09 +0800
committertypebrook <typebrook@gmail.com>2020-02-06 14:55:09 +0800
commitd97c47f56b99704b4aca772d1f4f29256f22dcd5 (patch)
tree8dfea7f052239c473ac00baa2bc8a5e4335a80ad
parentbf1545231d68f69932ef333ab09707698c9e2009 (diff)
update
-rwxr-xr-xscripts/gist11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/gist b/scripts/gist
index 31040bf..37dc997 100755
--- a/scripts/gist
+++ b/scripts/gist
@@ -21,6 +21,7 @@
21# config, c [token | user | folder | auto_sync | EDITOR | action [value] ] do configuration 21# config, c [token | user | folder | auto_sync | EDITOR | action [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 <pattern> push changes by git
24# help, h show this help message 25# help, h show this help message
25# 26#
26# Example: 27# Example:
@@ -189,6 +190,12 @@ _grep_content() {
189 _show_list other | grep -i $1 190 _show_list other | grep -i $1
190} 191}
191 192
193_push_to_remote() {
194 _gist_id $1
195 cd $folder/$GIST_ID && git add . \
196 && git commit --allow-empty-message -m '' && git push origin master
197}
198
192# parse JSON from STDIN with string of commands 199# parse JSON from STDIN with string of commands
193AccessJsonElement() { 200AccessJsonElement() {
194 PYTHONIOENCODING=utf-8 \ 201 PYTHONIOENCODING=utf-8 \
@@ -308,6 +315,7 @@ _goto_gist() {
308 echo $folder/$GIST_ID 315 echo $folder/$GIST_ID
309} 316}
310 317
318# TODO Add confirmation
311_delete_gist() { 319_delete_gist() {
312 for i in "$@"; do 320 for i in "$@"; do
313 _gist_id "$i" 321 _gist_id "$i"
@@ -486,6 +494,9 @@ case "$1" in
486 grep | g) 494 grep | g)
487 shift 495 shift
488 _grep_content "$@" ;; 496 _grep_content "$@" ;;
497 push | p)
498 shift
499 _push_to_remote "$@" ;;
489 help | h) 500 help | h)
490 usage ;; 501 usage ;;
491 *) 502 *)