diff options
| author | typebrook <typebrook@gmail.com> | 2020-02-08 20:27:32 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2020-02-08 20:27:32 +0800 |
| commit | 6de7d0e991e62e4315bc4473fa848635b14b515b (patch) | |
| tree | 6a231fa83938dc79ead7ce03f25874202bd54d73 /scripts/gist | |
| parent | ce8fa56e813af98d035190a52f5427010b21f72e (diff) | |
update
Diffstat (limited to 'scripts/gist')
| -rwxr-xr-x | scripts/gist | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/scripts/gist b/scripts/gist index fad035c..9d884d8 100755 --- a/scripts/gist +++ b/scripts/gist | |||
| @@ -37,7 +37,6 @@ | |||
| 37 | 37 | ||
| 38 | # TODO test on bats, mac and remote machine | 38 | # TODO test on bats, mac and remote machine |
| 39 | # TODO completion | 39 | # TODO completion |
| 40 | # FIXME mac: tac=tail -r | ||
| 41 | 40 | ||
| 42 | # Shell configuration | 41 | # Shell configuration |
| 43 | set -o pipefail | 42 | set -o pipefail |
| @@ -136,10 +135,8 @@ getConfiguredClient() { | |||
| 136 | configuredClient="wget" | 135 | configuredClient="wget" |
| 137 | elif command -v http &>/dev/null; then | 136 | elif command -v http &>/dev/null; then |
| 138 | configuredClient="httpie" | 137 | configuredClient="httpie" |
| 139 | elif command -v fetch &>/dev/null; then | ||
| 140 | configuredClient="fetch" | ||
| 141 | else | 138 | else |
| 142 | echo "Error: This tool requires either curl, wget, httpie or fetch to be installed." >&2 | 139 | echo "Error: This tool requires either curl, wget, or httpie to be installed." >&2 |
| 143 | return 1 | 140 | return 1 |
| 144 | fi | 141 | fi |
| 145 | } | 142 | } |
| @@ -157,8 +154,6 @@ http_method() { | |||
| 157 | httpie) [[ -n $token ]] && header="Authorization:token $token" | 154 | httpie) [[ -n $token ]] && header="Authorization:token $token" |
| 158 | [[ $METHOD =~ (POST|PATCH) ]] && extra2="@$http_data" | 155 | [[ $METHOD =~ (POST|PATCH) ]] && extra2="@$http_data" |
| 159 | http -b $METHOD "$@" "$header" $extra2 ;; | 156 | http -b $METHOD "$@" "$header" $extra2 ;; |
| 160 | # TODO add other methods | ||
| 161 | fetch) fetch -q "$@" ;; | ||
| 162 | esac | 157 | esac |
| 163 | } | 158 | } |
| 164 | 159 | ||