#!/bin/bash set -euo pipefail if [[ "$#" -gt 0 && ("$1" == "-h" || "$1" == "--help") ]]; then cat </, one a line list -h|--help A bucket's store keys (local-key-, the keys of szecret local stores) show at a terminal as one "stores:" line naming the stores; --names, --json and piped list name them as the files they are. Only names, never values; nothing is decrypted. Piped, plain "list" prints bare names, one a line, sorted (SZECRET_FORCE_TTY=1, or =, gives the terminal view instead). The old store counts as readable while the old key is here. Readers are named by the comment above their key in the bucket's recipients, and admins by a "# " line above theirs in SZECRET_ADMINS_COMMAND's output; a key with neither is "unnamed". The problems shown come from file names and headers alone: szecret check decrypts every file to be sure. Colour follows the terminal, and NO_COLOR turns it off. EOF exit 0 fi this_dir="$(cd "$(dirname "$(realpath "$0")")" && pwd)" source "${this_dir}/common.sh" all="" names_only="" json="" keys="" while [[ $# -gt 0 ]]; do case "$1" in --all) all=1 ;; --names) names_only=1 ;; --json) json=1 ;; --keys) keys=1 ;; *) die "usage: szecret list [--all] [--keys | --json | --names]" ;; esac shift done if [[ -n "${names_only}" && -n "${json}" ]]; then die "--names and --json are two different outputs: pick one" fi secrets_in() { local f for f in "$1"/*.age; do if [[ -e "${f}" ]]; then basename "${f}" .age fi done | LC_ALL=C sort } # Each bucket shown, then the old store, as "