summaryrefslogtreecommitdiff
path: root/src/password-store.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsrc/password-store.sh31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index ac3e20b..4266288 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -171,6 +171,8 @@ cmd_usage() {
$PROGRAM [show] [--clip,-c] pass-name
Show existing password and optionally put it on the clipboard.
If put on the clipboard, it will be cleared in $CLIP_TIME seconds.
+ $PROGRAM grep search-string
+ Search for password files containing search-string when decrypted.
$PROGRAM insert [--echo,-e | --multiline,-m] [--force,-f] pass-name
Insert new password. Optionally, echo the password back to the console
during entry. Or, optionally, the entry may be multiline. Prompt before
@@ -232,9 +234,9 @@ cmd_init() {
local passfile
find "$PREFIX/$id_path" -iname '*.gpg' | while read -r passfile; do
fake_uniqueness_safety="$RANDOM"
- passfile_dir=${passfile%/*}
- passfile_dir=${passfile_dir#$PREFIX}
- passfile_dir=${passfile_dir#/}
+ passfile_dir="${passfile%/*}"
+ passfile_dir="${passfile_dir#$PREFIX}"
+ passfile_dir="${passfile_dir#/}"
set_gpg_recipients "$passfile_dir"
$GPG -d $GPG_OPTS "$passfile" | $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile.new.$fake_uniqueness_safety" $GPG_OPTS &&
mv -v "$passfile.new.$fake_uniqueness_safety" "$passfile"
@@ -304,6 +306,28 @@ cmd_find() {
tree -l --noreport -P "*${terms// /*|*}*" --prune --matchdirs --caseinsensitive "$PREFIX" | tail -n +2 | sed 's/\.gpg$//'
}
+cmd_grep() {
+ if [[ $# -ne 1 ]]; then
+ echo "Usage: $PROGRAM $COMMAND search-string"
+ exit 1
+ fi
+ agent_check
+ local passfile
+ local passfile_dir
+ local grepresults
+ local search="$1"
+ find "$PREFIX" -iname '*.gpg' | while read -r passfile; do
+ grepresults="$($GPG -d $GPG_OPTS "$passfile" | grep --color=always "$search")"
+ [ $? -ne 0 ] && continue
+ passfile="${passfile%.gpg}"
+ passfile="${passfile#$PREFIX/}"
+ passfile_dir="${passfile%/*}"
+ passfile="${passfile##*/}"
+ printf "\e[94m$passfile_dir/\e[1m$passfile\e[0m:\n"
+ echo "$grepresults"
+ done
+}
+
cmd_insert() {
local multiline=0
local noecho=1
@@ -496,6 +520,7 @@ case "$1" in
version|--version) shift; cmd_version "$@"; ;;
show|ls|list) shift; cmd_show "$@"; ;;
find|search) shift; cmd_find "$@"; ;;
+ grep) shift; cmd_grep "$@"; ;;
insert) shift; cmd_insert "$@"; ;;
edit) shift; cmd_edit "$@"; ;;
generate) shift; cmd_generate "$@"; ;;
s.py?h=v0.13&id=0e97cc678cb9ec813460ca2e60a23595e753c2f8&follow=1'>Make logger thread-safeRené 'Necoro' Neumann1-3/+6 2008-03-18Fixed new_use_flag creation errorRené 'Necoro' Neumann1-3/+3 2008-03-18keep i18n up2dateRené 'Necoro' Neumann3-326/+366 2008-03-18corrected header commentRené 'Necoro' Neumann1-2/+2 2008-03-18Removed gtk subdirRené 'Necoro' Neumann21-134/+79 2008-03-18Removed wrapperRené 'Necoro' Neumann2-238/+184 2008-03-18Split and renamed gui_helperRené 'Necoro' Neumann4-249/+266 2008-03-18Splitted windows.pyRené 'Necoro' Neumann10-424/+549 2008-03-12Moved get_dependencies to top package classRené 'Necoro' Neumann4-50/+85 2008-03-11improved performance by caching the use_expand queriesRené 'Necoro' Neumann1-5/+14 2008-03-11use catapult varsRené 'Necoro' Neumann2-4/+6 2008-03-11Updated catapult stuffRené 'Necoro' Neumann5-56/+108 2008-03-10Generate correct KeyNotFoundExceptionRené 'Necoro' Neumann1-2/+2 2008-03-09Small changesRené 'Necoro' Neumann3-1/+4 2008-03-07Better session handlingRené 'Necoro' Neumann1-5/+54 2008-03-07Small changesRené 'Necoro' Neumann1-1/+4 2008-03-07Updated shm module to 1.2René 'Necoro' Neumann1-8/+21 2008-03-07Update TODORené 'Necoro' Neumann1-3/+1 2008-03-07hmm ... yesRené 'Necoro' Neumann1-1/+1 2008-03-06Used better exceptions for configuration parserRené 'Necoro' Neumann1-26/+114 2008-03-06Update translationRené 'Necoro' Neumann2-349/+393 2008-03-06Update createpot.shRené 'Necoro' Neumann1-3/+2 2008-03-06Use 'nofork' instead of 'nolistener'René 'Necoro' Neumann1-3/+3 2008-03-05Install glade files into template dir and not data dirRené 'Necoro' Neumann2-2/+1 2008-03-05Added dependency listRené 'Necoro' Neumann3-117/+237