diff options
author | typebrook <typebrook@gmail.com> | 2020-05-17 12:58:03 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2020-05-17 12:58:03 +0800 |
commit | 8efa0db70bf12565d3b080194e5e98be4ae49a0e (patch) | |
tree | 4676663465d86660917c4ba4ac1cb61a8d7389fa | |
parent | d55b5b062ba8380413f3e7860bb4abe6390a310a (diff) |
Sort gists from oldest to newest
-rwxr-xr-x | gist | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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 &) |