diff options
author | typebrook <typebrook@gmail.com> | 2020-01-21 14:53:43 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2020-01-21 14:53:43 +0800 |
commit | 603ff73d40330edce0e6157a3cfde823bb04c355 (patch) | |
tree | 9b0b929187b792bfc5f6230d9af4429f4c4a3ec2 /scripts | |
parent | 4e82affdfd9ddb6ccacd3aa2b8890146d5b3bfe4 (diff) |
update
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/gist | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/gist b/scripts/gist index 1f5b7be..8f89102 100755 --- a/scripts/gist +++ b/scripts/gist | |||
@@ -254,6 +254,20 @@ _help_message() { | |||
254 | sed -E -n ' /^$/ q; 8,$ s/^#//p' $0 | 254 | sed -E -n ' /^$/ q; 8,$ s/^#//p' $0 |
255 | } | 255 | } |
256 | 256 | ||
257 | _auth() { | ||
258 | data="{\"scopes\":[\"gist\"], \"note\": \"gist-$(date -u +'%Y-%m-%dT%H:%M:%SZ')\"}" | ||
259 | read -p "Github username: " user | ||
260 | read -sp "Github password: " password | ||
261 | curl https://api.github.com/authorizations \ | ||
262 | --user "$user:$password" \ | ||
263 | --data "$data" | ||
264 | |||
265 | read -sp "2-factor code: " OTP | ||
266 | curl https://api.github.com/authorizations \ | ||
267 | --user "$user:$password" -H "X-GitHub-OTP: $OTP" \ | ||
268 | --data "$data" | ||
269 | } | ||
270 | |||
257 | case "$1" in | 271 | case "$1" in |
258 | "") | 272 | "") |
259 | _show_list $index ;; | 273 | _show_list $index ;; |
@@ -278,6 +292,8 @@ case "$1" in | |||
278 | _clean_repos ;; | 292 | _clean_repos ;; |
279 | help | h) | 293 | help | h) |
280 | _help_message ;; | 294 | _help_message ;; |
295 | auth | a) | ||
296 | _auth ;; | ||
281 | *) | 297 | *) |
282 | _goto_gist "$1" ;; | 298 | _goto_gist "$1" ;; |
283 | esac | 299 | esac |