diff options
| author | typebrook <typebrook@gmail.com> | 2020-01-31 17:30:33 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2020-01-31 17:30:33 +0800 |
| commit | 9aaa20ef32e03a3dcc98a083d2df8018bc379684 (patch) | |
| tree | 3a59441923b1ff45d3222804e913796b36a9c626 | |
| parent | b992a5631ef62badf6f3bc8e36c2651433cb0d88 (diff) | |
update
| -rwxr-xr-x | scripts/gist | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/gist b/scripts/gist index 45ec76e..ea993e9 100755 --- a/scripts/gist +++ b/scripts/gist | |||
| @@ -116,18 +116,18 @@ _ask_token() { | |||
| 116 | 116 | ||
| 117 | _apply_config() { | 117 | _apply_config() { |
| 118 | source $CONFIG 2> /dev/null || true | 118 | source $CONFIG 2> /dev/null || true |
| 119 | if [[ ! -e $CONFIG ]] || [[ -z $user ]]; then | 119 | if [[ ! -e $CONFIG || -z $user ]]; then |
| 120 | echo 'Hi fellow! To access your gists, I need your Github username' | 120 | echo 'Hi fellow! To access your gists, I need your Github username' |
| 121 | echo "Also a personal token with scope which allows "gist"!'" | 121 | echo "Also a personal token with scope which allows "gist"!'" |
| 122 | echo | 122 | echo |
| 123 | _ask_username | 123 | _ask_username |
| 124 | _ask_token | 124 | _ask_token |
| 125 | elif [[ -z $token ]] && [[ $1 =~ ^(n|new|e|edit|D|delete)$ ]]; then | 125 | elif [[ -z $token && $1 =~ ^(n|new|e|edit|D|delete)$ ]]; then |
| 126 | if ! (_ask_token); then | 126 | if ! (_ask_token); then |
| 127 | echo 'To create/edit/delete a gist, a token is needed' | 127 | echo 'To create/edit/delete a gist, a token is needed' |
| 128 | return 1 | 128 | return 1 |
| 129 | fi | 129 | fi |
| 130 | elif [[ -z $token ]] && [[ $1 =~ ^(u|update)$ ]] && [[ $2 =~ ^(s|star) ]]; then | 130 | elif [[ -z $token && $1 =~ ^(u|update)$ && $2 =~ ^(s|star) ]]; then |
| 131 | if ! (_ask_token); then | 131 | if ! (_ask_token); then |
| 132 | echo 'To get user starred gists, a token is needed' | 132 | echo 'To get user starred gists, a token is needed' |
| 133 | return 1 | 133 | return 1 |