-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshenv
31 lines (24 loc) · 798 Bytes
/
.zshenv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
export PATH="$HOME/.bin:$PATH"
function version_info() {
local -r tool="$1"
echo "$(asdf current "$tool")" | awk '{print $2}'
}
function unlock_bw() {
local session_key
session_key="$(bw unlock --raw)"
export BW_SESSION="$session_key"
}
function example_load_secrets() {
local -r item_id='aaaaaaaa-bbbb-bbbb-bbbb-aaaaaaaaaaaa'
if [[ -z "${BW_SESSION}" ]]; then
unlock_bw
fi
export SOME_SECRET="$(bw get item "$item_id" | jq -r '.login.password')"
export SOME_SPECIAL_SECRET="$(echo "$item_id" | jq -r '.fields[] | select(.name == "Special Secret") | .value')"
}
function rgsed() {
local -r txtfind="$1"
local -r replacewith="$2"
local -r delim="${3:-|}"
rg "$txtfind" --files-with-matches | xargs sed -i "s${delim}${txtfind}${delim}${replacewith}${delim}g"
}