From f6d035f92e11e5432da3b9be2758ea619fb3cfbb Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Tue, 31 Dec 2019 17:49:41 -0500 Subject: Add strftime format string option --- scoop.1 | 11 +++++++++++ scoop.c | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/scoop.1 b/scoop.1 index a9a40c0..2dfdf09 100644 --- a/scoop.1 +++ b/scoop.1 @@ -10,6 +10,7 @@ .Nm .Op Fl gpqv .Op Fl D Ar date +.Op Fl F Ar format .Op Fl N Ar network .Op Fl T Ar target .Op Fl c Ar context @@ -47,6 +48,16 @@ of the format or the keyword .Cm now . . +.It Fl F Ar format +Format timestamps using the +.Ar format +string, +similar to +.Xr strftime 3 . +The default format is ISO8601. +See +.Lk https://www.sqlite.org/lang_datefunc.html +. .It Fl N Ar network Match events from contexts on .Ar network . diff --git a/scoop.c b/scoop.c index 2a78af8..d8e7607 100644 --- a/scoop.c +++ b/scoop.c @@ -29,8 +29,7 @@ static const char *Inner = SQL( SELECT contexts.network, contexts.name AS context, - // TODO: Replace with a strftime and option. - date(events.time) || 'T' || time(events.time) || 'Z' AS time, + strftime(coalesce(:format, '%Y-%m-%dT%H:%M:%SZ'), events.time) AS time, events.type, names.nick, CASE WHEN names.user = '*' @@ -183,9 +182,10 @@ int main(int argc, char *argv[]) { const char *search = NULL; int opt; - while (0 < (opt = getopt(argc, argv, "D:N:T:c:d:gh:l:n:pqst:u:v"))) { + while (0 < (opt = getopt(argc, argv, "D:F:N:T:c:d:gh:l:n:pqst:u:v"))) { switch (opt) { break; case 'D': binds[n++] = Bind(":date", optarg, 0); + break; case 'F': binds[n++] = Bind(":format", optarg, 0); break; case 'N': binds[n++] = Bind(":network", optarg, 0); break; case 'T': binds[n++] = Bind(":target", optarg, 0); break; case 'c': binds[n++] = Bind(":context", optarg, 0); -- cgit 1.4.1 hod='get' action='/torus/log/client.c'>
path: root/client.c (unfollow)
Commit message (Expand)Author
2017-08-08Add put modeJune McEnroe
2017-08-08Remove MADV_NOSYNCJune McEnroe
2017-08-08Completely retry if a send fails during a broadcastJune McEnroe
2017-08-08Reverse order of main loopJune McEnroe
2017-08-08Turn off SIGPIPE at the socket levelJune McEnroe
2017-08-06Rewrite helpJune McEnroe
2017-08-04Use $() in snapshot.shJune McEnroe
2017-08-02Move in insert direction on ~June McEnroe
2017-08-02Preserve color on replaceJune McEnroe
2017-08-02Split tile access and modifyJune McEnroe
2017-08-01Madvise RANDOM and NOSYNCJune McEnroe
2017-07-31Fix removing clients from clientCastJune McEnroe
2017-07-31Build with debug infoJune McEnroe
2017-07-31Don't dump tiles in coreJune McEnroe
2017-07-31Use designated initializers for messagesJune McEnroe
2017-07-31Show other clients' cursorsJune McEnroe
2017-07-31Perform enter as two moves rather than a loopJune McEnroe
2017-07-31Track tile access countsJune McEnroe
2017-07-31Adjust move speed in clientJune McEnroe
2017-07-31Handle large movesJune McEnroe
2017-07-30Optimize builds for chrootJune McEnroe
2017-07-30Persist bright across color changesJune McEnroe
2017-07-30Add index.htmlJune McEnroe
2017-07-30Add snapshot.shJune McEnroe
2017-07-30Fix termcap patch for background colorsJune McEnroe
2017-07-30Update helpJune McEnroe
2017-07-30Fix help to track colorJune McEnroe
2017-07-30Support background colorsJune McEnroe
2017-07-30Track color only client-sideJune McEnroe
2017-07-30Add ostensible support for background colorsJune McEnroe
2017-07-30Add tile create and access timestampsJune McEnroe
2017-07-30Assert stable struct Tile field offsetsJune McEnroe
2017-07-30Add chroot.shJune McEnroe
2017-07-30Add ` commandJune McEnroe
2017-07-30Add sshd_configJune McEnroe
2017-07-30Add termcap patchJune McEnroe