Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Viddy: A modern watch command. Time machine and pager etc. (github.com/sachaos)
203 points by lapser on June 21, 2022 | hide | past | favorite | 29 comments


Hi, I'm owner of the project. I am honored to be featured on HackerNews.

I've been busy and haven't been very active, but I'm trying to resume maintenance. If you have any requests, please mention them in GitHub Issues.


Funny viddy came up here today. I created this note about watch in my dotfiles just yesterday (edit: probably not watch's fault! oops..):

> # TODO: this is ugly, doesn't print colours, is there a modern version?

I couldn't get watch to print colours and styles, with the -c switch and forcing colour output on the "inner" command.

Viddy just works and I've immediately created an alias to watch, and substituted all my scripted watch usage. The history feature looks interesting and potentially super-useful, and I'll hopefully remember that exists when I have need for such a thing. Thank you, and keep up the great work!


Just curious, would you share the offending command? I’d be interested to take a crack at it.


I had two commands

> watch -c -n 1 -- systemctl --user --state=failed

> watch -c -n 1 -- lfs --color yes -c +inodes_use_percent

I didn't actually look for colour output for systemctl (yeah.. bad debugging, kinda lazy, but it wasn't very important so I didn't give it too much time). I thought I'd try to reproduce for you and thought I should have a quick look at colour output for systemctl, and came up with:

> watch -c -n 1 -- SYSTEMD_COLORS=1 systemctl --user --state=failed

which works well.

The lfs example still does not; I suspect it's probably ignoring the color arg depending on its environment (I wonder if watch changes the env?- not to imply it would be wrong to do so if so).

I feel a bit bad for making it look like this was watch's fault, when it probably isn't. I'll dig into the lfs thing later.


watch supports shell aliases if you put the following in your bashrc:

    alias watch='watch '
You probably want to do the same for sudo.

    alias [-p] [name[=value] ...]
        [...] A trailing space in value causes the next word
        to be checked for alias substitution when the alias is expanded.


For zsh you can create a global alias $=" " (I use $ because it is unlikely to be used anywhere but you can use anything and then just do watch $ myalias.

IIRC this doesn't work in bash.


What is that logo supposed to be?

Looks like a golang gopher getting eye drops while being injected with syringes.


It's a reference to the film A Clockwork Orange (also where the name "viddy" comes from). https://commons.wikimedia.org/wiki/File:LudovicoMalcolmMcDow...


The logo does indeed look like a reference to the movie, but A Clockwork Orange is originally a book. Highly recommended btw.


How many folks know it by the book vs the movie, though?


6.4


That gopher looks absolutely wired. Wonder what’s in those eye drops.


It's been a while since I watched the movie, but in "A Clockwork Orange" IIRC they were a hallucinogenic (probably acid) to enhance the horror of what he was being forced to watch, to further traumatize him against the images of ultraviolence in a negative way. so that when he had the desire to carry out acts of ultraviolence after the 'treatment' he had flashbacks to the horrific visions he was subjected to. And being in eyedrops had the dual purpose of not letting his eyes dry out while he was unable to blink due to his eyelids being clamped open (this was a treatment, not a torture...)


This is really neat. Reminds me of `lnav` which is a really awesome way to tail a logfile.


Useful, installed.

I'm a bit annoyed at the trend of not having man pages though.


The awesome go-cli package makes it trivial to generate man pages [1] based on the commands/flags. This can be easily added to CI to avoid having to maintain a separate man page.

[1]: https://pkg.go.dev/github.com/urfave/cli/v2#App.ToManWithSec...


Ah, so much this! Why do all these new utils not come with a man page? :(


They tend to have the most random names, too. Name after purpose would be good.


> Name after purpose would be good.

That used to be a lot easier when there was not that many tools out there. How many watch alternatives are there by now and how would you name them? watch, watchng, watch2?


Is it really hard to think for a few minutes and you could get a name from a word like "observe" instead?


This is lovely - pleasing to the eyes and nice features such as time machine

I see its in nixpkgs - think I'll alias it to watch right now


Yeah, I came across it a while ago, and figured I'd post it here when I ran watch today and viddy came up because I had aliased it when I came across it. I'm not sure how I haven't used watch since then but here we are.


Yea, this is cool. I use watch every once in a while. Good find.


>alias it to watch

It's not on-par with `watch` feature-wise. (-e and -g are not implemented)

Cool tool btw.


I'd suggest logging to sqlite to provide later replays and speed estimations at keypoints. It might be nice to also add some cascading signature of the timestamps for tamper evidence (ex: merkle tree)

Usecase: storing timestamped proof of execution, automating metrics history

User story: "after feature X got implemented, deployment became twice as slow as we can see from the viddy logs".


ttyrec[1] would be an alternative format that's been around for a while.

Would be an interesting feature to see here for recording, and can then be played back/analysed by various other tools.

[1] https://en.wikipedia.org/wiki/Ttyrec


I didn't know that format. Actually, I'm looking for the solution to record and review that later. It might be fit.

Thank you!


I am eternally grateful for the Clockwork Orange reference.


You can do the diff output with watch by using the -d option.

  watch -d <command>

The rollback feature seems useful.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: