This commit is contained in:
Morten Olsen
2023-09-16 12:33:21 +02:00
parent 6dbaad1bbe
commit 33f79566b7
65 changed files with 387 additions and 228 deletions

View File

@@ -0,0 +1,26 @@
function _bw_replace_env() {
env | while IFS= read -r line; do
value=${line#*=}
name=${line%%=*}
if [[ $value = bw://* ]]; then;
item=${value:5}
secret=`bw get password $item`
export $name="$secret"
fi
done
}
function clam-open() {
command=$1
if [[ -z "$BW_SESSION" ]]; then;
export BW_SESSION=`bw unlock --raw`
fi
_bw_replace_env
if [[ ! -z "$command" ]]; then;
eval $command
fi
}
function clam-close() {
unset BW_SESSION
}