From 9a2fcf29dc96246fdb8df93cf8bd3d42d7f6cca4 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Thu, 6 Jul 2017 00:52:59 -0500 Subject: [PATCH] Display labels side by side, log output. * Fit as many labels as possible on each line instead of only one per line. Includes several spaces of padding in between each label. * Add the `-o` option to also write logged output to a file. This is intended for use with the command-style invocation to keep a persistent log of the command's output for further investigation. * Added a TODO file with ideas for future improvements. --- TODO | 2 ++ log_happy.nim | 48 +++++++++++++++++++++++++++++++++++++----------- 2 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 TODO diff --git a/TODO b/TODO new file mode 100644 index 0000000..21833d0 --- /dev/null +++ b/TODO @@ -0,0 +1,2 @@ +* Implement -f functionality: follow a file. +* Respond to terminal resizing. diff --git a/log_happy.nim b/log_happy.nim index ab2363f..2eeaac4 100644 --- a/log_happy.nim +++ b/log_happy.nim @@ -2,7 +2,7 @@ ## ========= ## ## Little tool to extract expected information from log streams. -import json, logging, ncurses, os, osproc, streams, strutils, threadpool +import json, logging, ncurses, os, osproc, sequtils, streams, strutils, threadpool import nre except toSeq import private/ncurses_ext @@ -31,6 +31,9 @@ proc readStream(stream: Stream): void = when isMainModule: var cmdProc: Process + var inStream: Stream + var outFile: File + try: let usage = """ Usage: @@ -44,6 +47,8 @@ Options: -E