summary refs log tree commit diff
path: root/scoop.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-12-31 17:49:41 -0500
committerJune McEnroe <june@causal.agency>2019-12-31 17:49:41 -0500
commitf6d035f92e11e5432da3b9be2758ea619fb3cfbb (patch)
treea5d09ddf84d3d43b810d060ac3c31fa0dc577aff /scoop.c
parentRefactor binding in scoop (diff)
downloadlitterbox-f6d035f92e11e5432da3b9be2758ea619fb3cfbb.tar.gz
litterbox-f6d035f92e11e5432da3b9be2758ea619fb3cfbb.zip
Add strftime format string option
Diffstat (limited to 'scoop.c')
-rw-r--r--scoop.c6
1 files changed, 3 insertions, 3 deletions
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);