aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-05-17 12:58:03 +0800
committertypebrook <typebrook@gmail.com>2020-05-17 12:58:03 +0800
commit8efa0db70bf12565d3b080194e5e98be4ae49a0e (patch)
tree4676663465d86660917c4ba4ac1cb61a8d7389fa
parentd55b5b062ba8380413f3e7860bb4abe6390a310a (diff)
Sort gists from oldest to newest
-rwxr-xr-xgist5
1 files changed, 3 insertions, 2 deletions
diff --git a/gist b/gist
index 6e29fde..01c72c7 100755
--- a/gist
+++ b/gist
@@ -377,7 +377,7 @@ for gist in raw:
377_parse_response() { 377_parse_response() {
378 local num=$start_from_num 378 local num=$start_from_num
379 _parse_gists \ 379 _parse_gists \
380 | tac | nl -s' ' \ 380 | nl -s' ' \
381 | while read -r "${INDEX_FORMAT[@]:0:2}" public file_url_array "${INDEX_FORMAT[@]:4:7}"; do 381 | while read -r "${INDEX_FORMAT[@]:0:2}" public file_url_array "${INDEX_FORMAT[@]:4:7}"; do
382 local private_prefix=''; [[ $public == 'False' ]] && private_prefix=p 382 local private_prefix=''; [[ $public == 'False' ]] && private_prefix=p
383 [[ -n $num ]] && local index=${num} && num=$(($num+1)); index=${private_prefix}${prefix}${index} 383 [[ -n $num ]] && local index=${num} && num=$(($num+1)); index=${private_prefix}${prefix}${index}
@@ -427,7 +427,8 @@ _fetch_gists_with_pagnation() {
427 427
428 [[ ! -s $fetched_records ]] && echo 'Not a single valid gist' && return 0 428 [[ ! -s $fetched_records ]] && echo 'Not a single valid gist' && return 0
429 429
430 sed -i'' -Ee "/^$mark/ d" $INDEX; cat $fetched_records >> $INDEX 430 sed -i'' -Ee "/^$mark/ d" $INDEX
431 tac <$fetched_records | nl -s' ' | sed -Ee 's/^ *([^ ]+) ([[:alpha:]]?)[[:digit:]]+/\2\1/' >> $INDEX
431 hint=$hint _show_list 432 hint=$hint _show_list
432 433
433 [[ $auto_sync != false ]] && (_sync_repos &> /dev/null &) 434 [[ $auto_sync != false ]] && (_sync_repos &> /dev/null &)