diff options
| author | typebrook <typebrook@gmail.com> | 2020-05-12 10:30:35 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2020-05-12 10:30:35 +0800 |
| commit | 3d71afc578fc16fa6261c6749976cfbb7409cfa5 (patch) | |
| tree | 8611f15904ddb149d363a52c36e0f0c67ab6dd7c | |
| parent | 4bcc6af0ae198d99226cdfc6bdd098392f894547 (diff) | |
Refactor code
| -rwxr-xr-x | gist | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -135,11 +135,11 @@ http_method() { | |||
| 135 | || { echo "Error: no active internet connection" >&2; return 1; } | 135 | || { echo "Error: no active internet connection" >&2; return 1; } |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | httpGet(){ | 138 | httpGet() { |
| 139 | http_method GET "$@" | 139 | http_method GET "$@" |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | # Parse JSON from STDIN with string of commands | 142 | # Parse JSON from STDIN with string of python commands |
| 143 | _process_json() { | 143 | _process_json() { |
| 144 | PYTHONIOENCODING=utf-8 \ | 144 | PYTHONIOENCODING=utf-8 \ |
| 145 | python -c "from __future__ import print_function; import sys, json; $1" | 145 | python -c "from __future__ import print_function; import sys, json; $1" |
| @@ -676,7 +676,7 @@ _new_file() { | |||
| 676 | } | 676 | } |
| 677 | 677 | ||
| 678 | # Parse JSON object of a single gist | 678 | # Parse JSON object of a single gist |
| 679 | _gist_body(){ | 679 | _gist_body() { |
| 680 | _process_json " | 680 | _process_json " |
| 681 | import os.path | 681 | import os.path |
| 682 | files_json = {} | 682 | files_json = {} |