diff options
| author | Igor Soarez <igor@soarez.org> | 2026-09-17 19:45:23 +0100 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-09-17 19:45:23 +0100 |
| commit | 13cc065ec014b86369dfe4ad60d1a43fa06fd251 (patch) | |
| tree | 684690c61b7b59758c2aac132c65b81c86de0608 /secrets/list.sh | |
dotfiles
Shell, editor and terminal configuration, the tools that go with them, and
szecret, an age-based secret manager whose store lives elsewhere.
History restarts here. What came before was not written to be read by
anyone else, and carried machine names, addresses and an encrypted secret
store; it is kept privately instead. What is left is meant to be safe on
any machine, including one whose owner is not me: see CLAUDE.md for the
rule it is written to.
Diffstat (limited to 'secrets/list.sh')
| -rwxr-xr-x | secrets/list.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/secrets/list.sh b/secrets/list.sh new file mode 100755 index 0000000..bf087e3 --- /dev/null +++ b/secrets/list.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -euo pipefail + +if [[ "$#" -gt 0 && ("$1" == "-h" || "$1" == "--help") ]]; then + cat <<EOF +list: List all available secrets in the store + +Displays all secret names in the global store in a columnar format. + +Usage: + list + list -h|--help + +The command will: +1. List all .age files in the store directory +2. Remove the .age extension from filenames +3. Display the secret names in columns + +Note: Only shows secret names, not their values. +EOF + exit 0 +fi + +this_dir="$(cd "$(dirname "$(realpath "$0")")" && pwd)" +source "${this_dir}/common.sh" + +maybe_column() { + if [ -t 1 ]; then + column + else + cat + fi +} + +ls "${store}" | sed 's/\.age$//' | sort | maybe_column |
