pashage

Yet Another Opinionated Re-engineering of the Unix Password Store
git clone https://git.instinctive.eu/pashage.git
Log | Files | Refs | README | LICENSE

commit d0644d652237abc8c41aeb400c36f4c65e0fc5c4
parent e5c84a766e2e9717d8d4bd4c9502ed4d22d84f74
Author: Natasha Kerensikova <natgh@instinctive.eu>
Date:   Fri,  7 Nov 2025 19:16:17 +0000

GPG entries are optionally marked in raw list output
Diffstat:
Mspec/action_spec.sh | 16++++++++++++++++
Msrc/pashage.sh | 12++++++++++--
2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/spec/action_spec.sh b/spec/action_spec.sh @@ -1833,6 +1833,22 @@ Describe 'Action Functions' The status should be success The output should equal '' End + + It 'marks GPG names' + result() { + %text + #|other/lower + #|other/[lower.gpg] + #|root + #|subdir/subsub/[old] + #|[subdir.gpg] + } + BEGIN_GPG_NAME='[' + END_GPG_NAME=']' + When call do_list '' + The status should be success + The output should equal "$(result)" + End End Describe 'do_list_or_show' diff --git a/src/pashage.sh b/src/pashage.sh @@ -850,6 +850,8 @@ do_insert() { # Display the entry list rooted at the given relative directory # $1: path relative to prefix # ...: (optional) grep arguments to filter +# BEGIN_GPG_NAME: (optional) marker before gpg secret name +# END_GPG_NAME: (optional) marker after gpg secret name # Note that this function is recrusive and cannot use variables to hold state. do_list() { for FULL_ENTRY in "${PREFIX}/$1${1:+/}"*; do @@ -873,12 +875,18 @@ do_list() { if [ $# -le 1 ] \ || printf '%s\n' "${ITEM_NAME%.gpg}" | grep "$@" then + if ! [ "${ENTRY}" = "${ITEM_NAME}" ]; then + printf '%s' "${ENTRY%/*}/" + fi if ! [ -d "${FULL_ENTRY%.gpg}" ] \ && ! [ -f "${FULL_ENTRY%.gpg}.age" ] then - ENTRY="${ENTRY%.gpg}" + ITEM_NAME="${ITEM_NAME%.gpg}" fi - printf '%s\n' "${ENTRY}" + printf '%s%s%s\n' \ + "${BEGIN_GPG_NAME-}" \ + "${ITEM_NAME}" \ + "${END_GPG_NAME-}" fi fi unset ENTRY