summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--scoop.111
-rw-r--r--scoop.c6
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);
fer them to clientsJune McEnroe 2019-11-09Parse capabilitiesJune McEnroe 2019-11-09Avoid the reserved _A names with BIT macroJune McEnroe 2019-11-09Define macro for bit flag enumsJune McEnroe 2019-11-08Check that password is hashedJune McEnroe 2019-11-08Avoid calling getopt_long again after it returns -1June McEnroe 2019-11-08Only change AWAY status for registered clientsJune McEnroe 2019-11-07Just write the example normallyJune McEnroe 2019-11-07Include path in readlinkat errorJune McEnroe 2019-11-07Call clientConsume before clientRecvJune McEnroe 2019-11-06Use -l:filename in Linux.mkJune McEnroe 2019-11-06Fix compat.h for #defined strlcpyJune McEnroe 2019-11-06Allow unsetting LIBRESSL_PREFIXJune McEnroe 2019-11-06Document calico service configurationJune McEnroe 2019-11-06Document SASL EXTERNAL configuration in more detailJune McEnroe 2019-11-06Document pounce service configurationJune McEnroe 2019-11-06Mention Darwin and GNU/Linux in READMEJune McEnroe 2019-11-06Assume LibreSSL from brew on DarwinJune McEnroe 2019-11-06Remove -DNO_EXPLICIT_BZERO from Darwin.mkJune McEnroe 2019-11-06Don't install rc scripts or dirs on LinuxJune McEnroe