Once: Cache CLI Commands

(github.com)

16 points | by baquero 2 hours ago

5 comments

  • aktau 9 minutes ago
    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.
  • deadbunny 17 minutes ago
    I've always wanted to deal with cache invalidation in my terminal.
  • xuhu 14 minutes ago
    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"
  • stingraycharles 25 minutes ago
    Seems well-designed, but what’s the use case? I’m trying to think of them but my creativity is failing me.
    • frizlab 22 minutes ago
      From the example in the Readme, I guess retrieving a token from an API, using a secret fetched from a secure vault that requests a password or TouchID validation.

      Not sure if there could be other interesting uses. I can’t think of one anyways.

    • whilenot-dev 20 minutes ago
      I have the same question, especially since any CLI output can be stored explicitly in some variable or temp file. What's the advantage of storing the output implicitly?
  • baquero 2 hours ago
    Do you have CLI calls that you want to cache? Here you go!