diff options
author | typebrook <typebrook@gmail.com> | 2020-01-27 22:46:51 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2020-01-27 22:46:51 +0800 |
commit | ac21cd9d661c47377f3c27957423dc5052c41b61 (patch) | |
tree | f2c2162e1e71075a4451e42a5a74c51b60ae989a /scripts/gist | |
parent | daa30db50d3b32dfc2e91b241ff1e1594098634c (diff) |
update
Diffstat (limited to 'scripts/gist')
-rwxr-xr-x | scripts/gist | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/scripts/gist b/scripts/gist index 895d5c0..72d7ef9 100755 --- a/scripts/gist +++ b/scripts/gist | |||
@@ -76,8 +76,8 @@ _auth() { | |||
76 | read -p "2-factor code: " OTP < /dev/tty | 76 | read -p "2-factor code: " OTP < /dev/tty |
77 | curl https://api.github.com/authorizations \ | 77 | curl https://api.github.com/authorizations \ |
78 | --user "$user:$password" -H "X-GitHub-OTP: $OTP" \ | 78 | --user "$user:$password" -H "X-GitHub-OTP: $OTP" \ |
79 | --data "$data" |\ | 79 | --data "$data" \ |
80 | sed '1 s/[^{]//g' | jq -r .token \ | 80 | | sed '1 s/[^{]//g' | jq -r .token \ |
81 | | sed 's/^/token=/' >> $config | 81 | | sed 's/^/token=/' >> $config |
82 | } | 82 | } |
83 | 83 | ||
@@ -190,8 +190,8 @@ _goto_gist() { | |||
190 | if [[ ! -d $folder/$GIST_ID ]]; then | 190 | if [[ ! -d $folder/$GIST_ID ]]; then |
191 | echo 'Cloning gist as repo...' | 191 | echo 'Cloning gist as repo...' |
192 | git clone git@github.com:$GIST_ID.git $folder/$GIST_ID \ | 192 | git clone git@github.com:$GIST_ID.git $folder/$GIST_ID \ |
193 | && echo 'Repo is cloned' || \ | 193 | && echo 'Repo is cloned' \ |
194 | echo 'Failed to clone the gist' | 194 | || echo 'Failed to clone the gist' |
195 | fi | 195 | fi |
196 | 196 | ||
197 | echo This gist is at $folder/$GIST_ID | 197 | echo This gist is at $folder/$GIST_ID |
@@ -296,14 +296,14 @@ _help_message() { | |||
296 | 296 | ||
297 | _cases() { | 297 | _cases() { |
298 | if [[ $1 == 'token' ]]; then | 298 | if [[ $1 == 'token' ]]; then |
299 | [[ ${#2} -eq 40 ]] && echo $1=$2 ||\ | 299 | [[ ${#2} -eq 40 ]] && echo $1=$2 \ |
300 | echo -e Invalid token format, it is not 40 chars '\n' > /dev/tty | 300 | || echo -e Invalid token format, it is not 40 chars '\n' > /dev/tty |
301 | elif [[ $1 == 'auto_sync' ]]; then | 301 | elif [[ $1 == 'auto_sync' ]]; then |
302 | [[ $2 == 'false' ]] && echo $1=$2 ||\ | 302 | [[ $2 == 'false' ]] && echo $1=$2 \ |
303 | echo $1=true | 303 | || echo $1=true |
304 | elif [[ $1 == 'folder' ]]; then | 304 | elif [[ $1 == 'folder' ]]; then |
305 | [[ -n "$2" ]] && echo $1=$2 ||\ | 305 | [[ -n "$2" ]] && echo $1=$2 \ |
306 | echo $1=~/gist | 306 | || echo $1=~/gist |
307 | elif [[ $1 == 'user' ]]; then | 307 | elif [[ $1 == 'user' ]]; then |
308 | echo $1=$2 | 308 | echo $1=$2 |
309 | fi | 309 | fi |