summaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-01-31 15:16:03 +0800
committertypebrook <typebrook@gmail.com>2020-01-31 15:16:03 +0800
commitbf28b3c49ddf6629067e7b33ef45a0a8caa3c046 (patch)
tree1aefdb174a440d86e2af2f6aac5c08a30f4e3077 /scripts
parent85d5cc6965fbc4f7937b681c01c4c1936cec6b22 (diff)
update
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gist7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/gist b/scripts/gist
index 405b48a..182425c 100755
--- a/scripts/gist
+++ b/scripts/gist
@@ -92,7 +92,7 @@ _configure() {
92 92
93_ask_username() { 93_ask_username() {
94 while [[ ! $user =~ ^[[:alnum:]]+$ ]]; do 94 while [[ ! $user =~ ^[[:alnum:]]+$ ]]; do
95 [[ ! -z $user ]] && echo "Not a valid username" 95 [[ -n $user ]] && echo "Not a valid username"
96 read -p "Github username: " user < /dev/tty 96 read -p "Github username: " user < /dev/tty
97 done 97 done
98 _configure user $user 98 _configure user $user
@@ -106,7 +106,7 @@ _ask_token() {
106 fi 106 fi
107 107
108 while [[ ! $token =~ ^[[:alnum:]]{40}$ ]]; do 108 while [[ ! $token =~ ^[[:alnum:]]{40}$ ]]; do
109 [[ ! -z $token ]] && echo "Not a valid token" 109 [[ -n $token ]] && echo "Not a valid token"
110 trap 'echo; return 1' INT 110 trap 'echo; return 1' INT
111 read -p "Paste your token here (Ctrl-C to skip): " token < /dev/tty 111 read -p "Paste your token here (Ctrl-C to skip): " token < /dev/tty
112 done 112 done
@@ -282,7 +282,8 @@ _goto_gist() {
282 282
283 if [[ ! -d $folder/$GIST_ID ]]; then 283 if [[ ! -d $folder/$GIST_ID ]]; then
284 echo 'Cloning gist as repo...' 284 echo 'Cloning gist as repo...'
285 if (git clone git@github.com:$GIST_ID.git $folder/$GIST_ID); then 285 git clone git@github.com:$GIST_ID.git $folder/$GIST_ID
286 if [[ "$?" -ne 0 ]]; then
286 echo 'Repo is cloned' 287 echo 'Repo is cloned'
287 return 0 288 return 0
288 else 289 else