logoalt Hacker News

Once: Cache CLI commands

72 points • by baquero • today at 9:43 AM • 30 comments • view on HN

Comments

aktau • today at 11:59 AM

These kinds of tools are very useful. I have my own called memo (which is just a shell script: https://github.com/aktau/dotfiles/blob/master/bin/memo).

It was discussed in https://news.ycombinator.com/item?id=45670052 and others chimed in with their own (like bkt(1) and up(1)).

The main differences I see:

  - memo doesn't need to be built (its a shell script)
  - once keeps output cache in a running daemon. By contrast, memo stores content under /tmp with whatever the best compression available is (it prefers zstd). There's trade-offs in that. More pareto-optimal from the security front may be to have a sort of session key and to compress-then-encrypt files on disk.
__MatrixMan__ • today at 1:58 PM

I dream of applications that expose sufficient metadata about their outputs such that the OS can know if rerunning is necessary without me needing to specify.

xuhu • today at 11:54 AM

I wish this worked without prefixing the commands with "once". Especially if I ran a command with verbose output and afterwards decided I wanted to grep something from it. Terminals have the output in their scrollback buffer and maybe it's just a matter of writing an "output" command that lets me run:

    $ cmake ..
    $ output | grep "libssl version"
➕ show 1 reply
deadbunny • today at 11:51 AM

I've always wanted to deal with cache invalidation in my terminal.

giancarlostoro • today at 1:39 PM

> The typical use case: reading secrets from 1Password without approving every single read with your fingerprint.

Uh I dont know about that one chief.

➕ show 1 reply
1vuio0pswjnm7 • today at 4:46 PM

I just use tmux buffers

But I'm not running agents, I have different needs

hecomo • today at 3:46 PM

This looks awesome. Thanks for making this.

Been using this, for similar cli output catching. https://github.com/dimo414/bkt

Wondering what you think about the two, and what are the good reasons to use one vs the other? (Maybe: once is more actively developed? bkt hasn't been active for a year).

stingraycharles • today at 11:43 AM

Seems well-designed, but what’s the use case? I’m trying to think of them but my creativity is failing me.

➕ show 3 replies
baquero • today at 9:43 AM

Do you have CLI calls that you want to cache? Here you go!

newadays • today at 2:52 PM

Congratulations. What is Word Error Rate? We have a few use cases for something like that at newcare.app

singularityisne • today at 2:03 PM

[flagged]