From d97c47f56b99704b4aca772d1f4f29256f22dcd5 Mon Sep 17 00:00:00 2001 From: typebrook Date: Thu, 6 Feb 2020 14:55:09 +0800 Subject: update --- scripts/gist | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/gist b/scripts/gist index 31040bf..37dc997 100755 --- a/scripts/gist +++ b/scripts/gist @@ -21,6 +21,7 @@ # config, c [token | user | folder | auto_sync | EDITOR | action [value] ] do configuration # user, U get gists from a given Github user # grep, g grep gists by a given pattern +# push, p push changes by git # help, h show this help message # # Example: @@ -189,6 +190,12 @@ _grep_content() { _show_list other | grep -i $1 } +_push_to_remote() { + _gist_id $1 + cd $folder/$GIST_ID && git add . \ + && git commit --allow-empty-message -m '' && git push origin master +} + # parse JSON from STDIN with string of commands AccessJsonElement() { PYTHONIOENCODING=utf-8 \ @@ -308,6 +315,7 @@ _goto_gist() { echo $folder/$GIST_ID } +# TODO Add confirmation _delete_gist() { for i in "$@"; do _gist_id "$i" @@ -486,6 +494,9 @@ case "$1" in grep | g) shift _grep_content "$@" ;; + push | p) + shift + _push_to_remote "$@" ;; help | h) usage ;; *) -- cgit v1.2.3-70-g09d2