News for hackers. Stuff that matters.
Re:CLI tool to insert spacers when command output stops by zmw on Monday December 23, 2024 @10:41AM (#42495166)
Related shameless plug: I have a small tool that prepends each output line with a timestamp (can be absolute, relative, or elapsed since last line), might be useful or pair well with this tool in similar scenarios (not needed when dealing with already timestamped logs, of course).

https://github.com/zmwangx/ets

Re:CLI tool to insert spacers when command output stops by fcoury on Monday December 23, 2024 @11:18AM (#42495492)
Very useful, thanks for sharing.
Re:CLI tool to insert spacers when command output stops by grandchild on Monday December 23, 2024 @12:27PM (#42495999)
There is also `ts` from moreutils[0]. One of a few gems there. And moreutils is (probably) already in "your" distro.

[0] https://joeyh.name/code/moreutils/

Re:CLI tool to insert spacers when command output stops by ievans on Monday December 23, 2024 @01:32PM (#42496539)
Looks like the `ets` readme has a direct comparison:

> The purpose of ets is similar to that of moreutils ts(1), but ets differentiates itself from similar offerings by running commands directly within ptys, hence solving thorny issues like pipe buffering and commands disabling color and interactive features when detecting a pipe as output. (ets does provide a reading-from-stdin mode if you insist.) ets also recognizes carriage return as a line seperator, so it doesn't choke if your command prints a progress bar. A more detailed comparison of ets and ts can be found below.

Re:CLI tool to insert spacers when command output stops by ErikBjare on Tuesday December 24, 2024 @01:27PM (#42503797)
Yet another fantastic joeyh project in my toolkit, thanks! (git-annex is awesome)
Re:CLI tool to insert spacers when command output stops by 3eb7988a1663 on Monday December 23, 2024 @12:34PM (#42496067)
This seems great. Unfortunately, I will only recall it exists once I am into minute-unknown-but-way-too-long-for-comfort while waiting for a command to complete.

Edit: Maybe you should highlight the trailing pipe example (eg `ping localhost | grep icmp | ets`)? That is way more convenient to use than the introductory samples indicate. Being able to slap it onto the end of a pipeline I am developing feels less invasive than potentially have to quote my command for the sake of a debugging tool.

Re:CLI tool to insert spacers when command output stops by pksadiq on Monday December 23, 2024 @08:14PM (#42498916)
I wrote a similar tool[0] a few days back because I wanted a bit more accuracy with timestamp and `ts` occasionally had a deviation of several 100ms. If I new this, and is accurate enough for me, I might not have written one.

[0] https://www.sadiqpk.org/projects/tis