Skip to content

Commit

Permalink
Merge pull request #1 from lelutin/recurse_directories
Browse files Browse the repository at this point in the history
recurse on directories
  • Loading branch information
Kdecherf authored Apr 1, 2018
2 parents 335349c + 75c1e32 commit 2f1d5c0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions report.bash
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,21 @@ cmd_report() {

[ ! -d "$PREFIX/.git" ] && _die "Your password store does not use .git, can't show report"

[ -z "$file" ] && _cmd_report_all_passwords || _cmd_report_password ${file%/}
if [ -z "$file" ]; then
_cmd_report_all_passwords
else
if [ -d "${PREFIX}/${file}" ]; then
_cmd_report_all_passwords "$file"
else
_cmd_report_password ${file%/}
fi
fi
}

_cmd_report_all_passwords() {
git -C "$PREFIX" ls-tree -r --name-only HEAD | grep -E "\.gpg$" | while read filename ; do
pass_prefix="$1"

git -C "$PREFIX" ls-tree -r --name-only HEAD | grep "^${pass_prefix}" | grep -E "\.gpg$" | while read filename ; do
_cmd_report_password "$filename"
done
}
Expand Down

0 comments on commit 2f1d5c0

Please sign in to comment.