Support selecting time ranges 0.20.0
authorSiraaj Khandkar <siraaj@khandkar.net>
Mon, 29 Mar 2021 12:41:37 +0000 (08:41 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Mon, 29 Mar 2021 12:41:37 +0000 (08:41 -0400)
TODO
info.rkt
tt.rkt

diff --git a/TODO b/TODO
index b48bfd8..f669c72 100644 (file)
--- a/TODO
+++ b/TODO
@@ -10,6 +10,13 @@ Legend:
 
 In-progress
 -----------
+- [-] timeline limits
+  - [x] by time range
+  - [ ] by msg count
+    - [ ] per peer
+    - [ ] total
+      Not necessary for short format, because we have Unix head/tail,
+      but may be convinient for long format (because msg spans multiple lines).
 - [-] Convert to Typed Racket
   - [x] build executable (otherwise too-slow)
   - [-] add signatures
@@ -99,6 +106,7 @@ In-progress
 
 Backlog
 -------
+- [ ] Support date without time in timestamps
 - [ ] Crawl all cache/objects/*, not given peers.
   BUT, in order to build A-mentioned-B graph, we need to know the nick
   associated with the URI whos object we're examining. How to do that?
@@ -136,10 +144,8 @@ Backlog
   - [ ] download times per peer
 - [ ] Support redirects
   - should permanent redirects update the peer ref somehow?
-- [ ] Support time ranges (i.e. reading the timeline between given time points)
 - [ ] optional text wrap
 - [ ] write
-- [ ] timeline limits
 - [ ] peer refs set operations (perhaps better done externally?)
 - [ ] timeline as a result of a query (peer ref set op + filter expressions)
 - [ ] config files
@@ -168,6 +174,7 @@ Backlog
 
 Done
 ----
+- [x] Support time ranges (i.e. reading the timeline between given time points)
 - [x] Dedup read-in peers before using them.
 - [x] Prevent redundant downloads
   - [x] Check ETag
index 2b1ab2d..439e3d3 100644 (file)
--- a/info.rkt
+++ b/info.rkt
@@ -6,7 +6,7 @@
 (define pkg-desc
   "twtxt client")
 (define version
-  "0.19.2")
+  "0.20.0")
 (define pkg-authors
   '("Siraaj Khandkar <siraaj@khandkar.net>"))
 (define deps
diff --git a/tt.rkt b/tt.rkt
index afc94f6..9a38136 100644 (file)
--- a/tt.rkt
+++ b/tt.rkt
                (exit 1)))]
         [(or "r" "read")
          (let ([out-format 'multi-line]
-               [order      'old->new])
+               [order      'old->new]
+               [ts-min     #f]
+               [ts-max     #f])
            (command-line
              #:program
              "tt read"
              [("-r" "--rev")
               "Reverse displayed timeline order."
               (set! order 'new->old)]
+             [("-m" "--min")
+              m "Earliest time to display (ignore anything before it)."
+              (set! ts-min (rfc3339->epoch m))]
+             [("-x" "--max")
+              x "Latest time to display (ignore anything after it)."
+              (set! ts-max (rfc3339->epoch x))]
              #:once-any
              [("-s" "--short")
               "Short output format"
              (let* ([peers
                       (paths->peers file-paths)]
                     [timeline
-                      (timeline-sort (peers->timeline peers) order)])
+                      (timeline-sort (peers->timeline peers) order)]
+                    [timeline
+                      (filter (λ (m) (and (if ts-min (>= (Msg-ts-epoch m)
+                                                         ts-min)
+                                              #t)
+                                          (if ts-max (<= (Msg-ts-epoch m)
+                                                         ts-max)
+                                              #t)))
+                              timeline)])
                (timeline-print out-format timeline))))]
         [(or "c" "crawl")
          (command-line
This page took 0.033917 seconds and 4 git commands to generate.