From 603ff73d40330edce0e6157a3cfde823bb04c355 Mon Sep 17 00:00:00 2001 From: typebrook Date: Tue, 21 Jan 2020 14:53:43 +0800 Subject: update --- scripts/gist | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'scripts/gist') diff --git a/scripts/gist b/scripts/gist index 1f5b7be..8f89102 100755 --- a/scripts/gist +++ b/scripts/gist @@ -254,6 +254,20 @@ _help_message() { sed -E -n ' /^$/ q; 8,$ s/^#//p' $0 } +_auth() { + data="{\"scopes\":[\"gist\"], \"note\": \"gist-$(date -u +'%Y-%m-%dT%H:%M:%SZ')\"}" + read -p "Github username: " user + read -sp "Github password: " password + curl https://api.github.com/authorizations \ + --user "$user:$password" \ + --data "$data" + + read -sp "2-factor code: " OTP + curl https://api.github.com/authorizations \ + --user "$user:$password" -H "X-GitHub-OTP: $OTP" \ + --data "$data" +} + case "$1" in "") _show_list $index ;; @@ -278,6 +292,8 @@ case "$1" in _clean_repos ;; help | h) _help_message ;; + auth | a) + _auth ;; *) _goto_gist "$1" ;; esac -- cgit v1.2.3-70-g09d2