aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/gist
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-02-07 15:29:18 +0800
committertypebrook <typebrook@gmail.com>2020-02-07 15:29:18 +0800
commit1fddc6ee30028f78c887098bd09d9a6d7f74a877 (patch)
tree0b0364a96f186c63d7d36e2c3792a4e7011bffb7 /scripts/gist
parent57f0978e7a755f459ec05425ed0ca69258b7c031 (diff)
update
Diffstat (limited to 'scripts/gist')
-rwxr-xr-xscripts/gist15
1 files changed, 13 insertions, 2 deletions
diff --git a/scripts/gist b/scripts/gist
index 20748fd..9420243 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# github, G <index_of_gist> Import this gist as a new Github repo
24# push, p <pattern> push changes by git 25# push, p <pattern> push changes by git
25# help, h show this help message 26# help, h show this help message
26# 27#
@@ -34,7 +35,6 @@
34# Since now a gist is a local cloned repo 35# Since now a gist is a local cloned repo
35# It is your business to do git commit and git push 36# It is your business to do git commit and git push
36 37
37# TODO import to github repo (may need a new token)
38# TODO test on bats, mac and remote machine 38# TODO test on bats, mac and remote machine
39# TODO completion 39# TODO completion
40 40
@@ -192,7 +192,15 @@ _show_list() {
192 192
193# TODO support filenames, file contents 193# TODO support filenames, file contents
194_grep_content() { 194_grep_content() {
195 _show_list other | grep -i $1 195 _show_list | grep -i $1
196}
197
198# TODO support filenames, file contents
199_import_to_github() {
200 _gist_id $1
201 echo put the folowing URL into webpage:
202 echo -n git@github.com:$GIST_ID.git
203 python -mwebbrowser https://github.com/new/import
196} 204}
197 205
198_push_to_remote() { 206_push_to_remote() {
@@ -508,6 +516,9 @@ case "$1" in
508 grep | g) 516 grep | g)
509 shift 517 shift
510 _grep_content "$@" ;; 518 _grep_content "$@" ;;
519 github | G)
520 shift
521 _import_to_github "$1" ;;
511 push | p) 522 push | p)
512 shift 523 shift
513 _push_to_remote "$1" ;; 524 _push_to_remote "$1" ;;