From 7c39ace1b87baea67f7fc249bb390c873e95332e Mon Sep 17 00:00:00 2001 From: typebrook Date: Fri, 17 Jan 2020 10:00:57 +0800 Subject: update --- scripts/gist | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'scripts/gist') diff --git a/scripts/gist b/scripts/gist index 15d7003..9457474 100755 --- a/scripts/gist +++ b/scripts/gist @@ -21,7 +21,7 @@ # gist [sync | s] # # * Go to local gist repo -# gist +# . gist # # * create a new gist with a file and description # gist [create | c] "" @@ -44,6 +44,8 @@ # define your environmemnts here # TODO support auth prompt # TODO add starred repos +# TODO error handling +# completion #------------------- github_api_token=$(cat $SETTING_DIR/tokens/github) user=typebrook @@ -65,9 +67,10 @@ _show_list() { cat $index |\ while read line_num link file_url_array file_num extra description; do repo=$folder/$(echo $link | sed 's#.*/##') + # if repo is not yet cloned, show green message "Sync Now" cd $repo 2>/dev/null || extra="\e[32m[Sync Now]\e[0m" - # if there is something need to commit, show blue message "working" + # if there are some changes in git index or working directory, show blue message "working" [[ -n $(git status --short) ]] 2>/dev/null && extra="\e[36m[working]\e[0m" # if there is a commit not yet push, show red message "ahead" [[ -n $(git cherry) ]] 2>/dev/null && extra="\e[31m[ahead]\e[0m" @@ -90,6 +93,9 @@ _update() { (_sync_repos > /dev/null 2>&1 &) } +_starred() { +} + _sync_repos() { # clone repos which are not in the local comm -13 <(find $folder -maxdepth 1 -type d | sed '1d; s#.*/##' | sort) \ -- cgit v1.2.3-70-g09d2