summaryrefslogtreecommitdiffhomepage
path: root/scripts/gist
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-01-20 11:48:53 +0800
committertypebrook <typebrook@gmail.com>2020-01-20 11:48:53 +0800
commit97d07e409fcba279fa0283d3be20ff0d22c66797 (patch)
tree337a6c3831e7506a304d1af4dab2008e60ccdd86 /scripts/gist
parent902759b00f13eb197a94dc4d287ae1fc74939ef4 (diff)
update
Diffstat (limited to 'scripts/gist')
-rwxr-xr-xscripts/gist6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/gist b/scripts/gist
index 403c912..55c9ab8 100755
--- a/scripts/gist
+++ b/scripts/gist
@@ -196,7 +196,7 @@ _new_file() {
196 tmp_file=$(mktemp) 196 tmp_file=$(mktemp)
197 cat > $tmp_file 197 cat > $tmp_file
198 echo 198 echo
199 [[ -z "$1" ]] && echo -n 'Type file name: ' > /dev/tty && read filename 199 [[ -z "$1" ]] && echo -en '\nType file name: ' > /dev/tty && read filename
200 mv $tmp_file /tmp/$filename 200 mv $tmp_file /tmp/$filename
201 echo /tmp/$filename 201 echo /tmp/$filename
202} 202}
@@ -220,7 +220,7 @@ _set_gist() {
220_create_gist() { 220_create_gist() {
221 _set_gist "$@" 221 _set_gist "$@"
222 [[ -z $files ]] && files=$(_new_file $filename) 222 [[ -z $files ]] && files=$(_new_file $filename)
223 [[ -z $description ]] && echo -n 'Description: ' && read description 223 [[ -z $description ]] && echo -en '\nDescription: ' && read description
224 224
225 for file in $files; do 225 for file in $files; do
226 FILE=$(basename $file) 226 FILE=$(basename $file)
@@ -231,7 +231,7 @@ _create_gist() {
231 files: add, 231 files: add,
232 description: ($DESC) 232 description: ($DESC)
233 }' |\ 233 }' |\
234 curl -s -H "$auth_header" --data @- $github_api/gists |\ 234 curl -H "$auth_header" --data @- $github_api/gists |\
235 sed '1 s/^/[/; $ s/$/]/' |\ 235 sed '1 s/^/[/; $ s/$/]/' |\
236 _parse_response |\ 236 _parse_response |\
237 sed -E "s/^/$(( $(wc -l $index | cut -d' ' -f1) + 1 )) /" >> $index && \ 237 sed -E "s/^/$(( $(wc -l $index | cut -d' ' -f1) + 1 )) /" >> $index && \