Once: Cache CLI Commands
The article introduces 'once', a command-line utility that caches the output of terminal commands to avoid repetitive authentication prompts. It is designed for developers to manage secrets and environment variables more efficiently.
Why it matters
It provides a practical tool for developers to streamline workflows and improve security hygiene when handling sensitive credentials.
Run a command once, reuse its output for a while.
once executes a command in your current directory, prints its stdout and keeps it in memory in a small per-user background daemon. Repeated calls with the same command, directory and tenant key are answered from memory until the entry expires. The daemon stops by itself once its last entry has expired.
The typical use case: reading secrets from 1Password without approving every single read with your fingerprint.
# once, e.g. in ~/.zshrc: a tenant key for this terminal session export ONCE_TENANT= " ${ONCE_TENANT :- $(uuidgen)} " # later while you work in your scripts / direnv / mise.toml export GITHUB_TOKEN= " $( once --ttl 8h --no-dir -- op read op://Private/GitHub/token ) " The first call asks for your fingerprint, every further call within 8 hours with the same tenant key does not.
Get smarter about the news
Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.
Create free accountAlready have an account? Sign in