commit 0669da315b1453e2bcc0612ca20c7fc5a56d1d7e
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2022-08-13T18:01:33Z |
| subject | added kstore-search |
commit 0669da315b1453e2bcc0612ca20c7fc5a56d1d7e
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2022-08-13T18:01:33Z
added kstore-search
---
bash/bashrc/sources/16_keystore | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/bash/bashrc/sources/16_keystore b/bash/bashrc/sources/16_keystore
index 4142b20..d75ac69 100644
--- a/bash/bashrc/sources/16_keystore
+++ b/bash/bashrc/sources/16_keystore
@@ -33,10 +33,10 @@ function kstore {
*)
__func_head "add [key] [value|file|-] [prop, default: $_KSTORE_DEF_PROP]"
__func_help "update [key] [value|file|-] [prop, default: $_KSTORE_DEF_PROP]"
- __func_help "get key [prop, default: $_KSTORE_DEF_PROP]"
+ __func_help "get [key] [prop, default: $_KSTORE_DEF_PROP]"
+ __func_help "del [key]"
__func_help "list"
- __func_help "del key"
- __func_help "search key"
+ __func_help "search [key] [prop]"
__func_help "secret ..."
__func_help "query SQL"
return 1
@@ -288,7 +288,12 @@ function kstore-del {
}
function kstore-search {
- echo "Not implemented yet"
+ local _termk _termp _cond
+ _termk=`kstore-quote "$1"`
+ _termp=`kstore-quote "$2"`
+ _cond="key LIKE '%$_termk%' AND prop LIKE '%$_termp%'"
+
+ $_SQLITE -header -column "$_AUTH_DB" "SELECT key, prop, length( data ) FROM store WHERE $_cond;"
}
function kstore-list {