diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/gist | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/gist b/scripts/gist index feebfcc..84b6dc7 100755 --- a/scripts/gist +++ b/scripts/gist | |||
| @@ -111,18 +111,19 @@ _ask_token() { | |||
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | _apply_config() { | 113 | _apply_config() { |
| 114 | source $config | ||
| 114 | if [[ ! -e $config ]] || [[ -z $user ]]; then | 115 | if [[ ! -e $config ]] || [[ -z $user ]]; then |
| 115 | echo 'Hi fellow! To access your gists, I need your Github username, also a personal token with scope which allows "gist"!' | 116 | echo 'Hi fellow! To access your gists, I need your Github username, also a personal token with scope which allows "gist"!' |
| 116 | _ask_username | 117 | _ask_username |
| 117 | _ask_token | 118 | _ask_token |
| 118 | elif [[ -z $token ]] && [[ $2 =~ ^(n|new|e|edit|D|delete)$ ]]; then | 119 | elif [[ -z $token ]] && [[ $1 =~ ^(n|new|e|edit|D|delete)$ ]]; then |
| 119 | _ask_token | 120 | _ask_token |
| 120 | fi | 121 | fi |
| 121 | 122 | ||
| 122 | source $config | 123 | source $config |
| 123 | } | 124 | } |
| 124 | 125 | ||
| 125 | _apply_config | 126 | _apply_config "$@" |
| 126 | 127 | ||
| 127 | auth_header="Authorization: token $token" | 128 | auth_header="Authorization: token $token" |
| 128 | 129 | ||