home
/
code
/
tt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Support sort order reversal
[tt.git]
/
tt.rkt
diff --git
a/tt.rkt
b/tt.rkt
index
c0e2c5c
..
4b90055
100644
(file)
--- a/
tt.rkt
+++ b/
tt.rkt
@@
-241,9
+241,13
@@
(void (concurrent-filter-map num_workers feed-download feeds)))
; TODO timeline contract : time-sorted list of messages
(void (concurrent-filter-map num_workers feed-download feeds)))
; TODO timeline contract : time-sorted list of messages
-(define (timeline-read feeds)
+; timeline-read : (U 'old->new 'new->old) -> (Listof Feeds) -> (Listof Msg)
+(define (timeline-read order feeds)
+ (define cmp (match order
+ ['old->new <]
+ ['new->old >]))
(sort (append* (filter-map feed->msgs feeds))
(sort (append* (filter-map feed->msgs feeds))
- (λ (a b)
[< (msg-ts_epoch a) (msg-ts_epoch b)]
)))
+ (λ (a b)
(cmp (msg-ts_epoch a) (msg-ts_epoch b))
)))
(define (str->feed str)
; TODO validation
(define (str->feed str)
; TODO validation
@@
-326,10
+330,15
@@
(timeline-download num_workers (file->feeds filename))
))]
[(or "r" "read")
(timeline-download num_workers (file->feeds filename))
))]
[(or "r" "read")
- (let ([out-format 'multi-line])
+ (let ([out-format 'multi-line]
+ [order 'old->new])
(command-line
#:program
"tt read"
(command-line
#:program
"tt read"
+ #:once-each
+ [("-r" "--rev")
+ "Reverse displayed timeline order."
+ (set! order 'new->old)]
#:once-any
[("-s" "--short")
"Short output format"
#:once-any
[("-s" "--short")
"Short output format"
@@
-338,5
+347,5
@@
"Long output format"
(set! out-format 'multi-line)]
#:args (filename)
"Long output format"
(set! out-format 'multi-line)]
#:args (filename)
- (timeline-print out-format (timeline-read (file->feeds filename)))))]
+ (timeline-print out-format (timeline-read
order
(file->feeds filename)))))]
))))
))))
This page took
0.021948 seconds
and
4
git commands to generate.