shortcuts and cleanup
This commit is contained in:
parent
be70dc5c6b
commit
adc2074288
1 changed files with 19 additions and 13 deletions
32
bwzy
32
bwzy
|
|
@ -10,12 +10,10 @@ cleanup() {
|
||||||
# defaults
|
# defaults
|
||||||
BWZY_CACHE="${BWZY_CACHE:-/dev/shm/bwzy-cache}"
|
BWZY_CACHE="${BWZY_CACHE:-/dev/shm/bwzy-cache}"
|
||||||
BWZY_FILTER="${BWZY_FILTER:-zz~ }"
|
BWZY_FILTER="${BWZY_FILTER:-zz~ }"
|
||||||
|
# options passed to fzf for default and oneshot modes
|
||||||
BWZY_DEFAULT_OPTS=(--layout reverse --height 100%)
|
BWZY_DEFAULT_OPTS=(--layout reverse --height 100%)
|
||||||
BWZY_ONESHOT_OPTS=(--layout default --height 10 --no-header)
|
BWZY_ONESHOT_OPTS=(--layout default --height 10 --no-header)
|
||||||
|
# visual settings
|
||||||
bwzy_autofill=${BWZY_AUTOFILL_HELPER:-"$(dirname "$0")/bwzy-autofill"}
|
|
||||||
|
|
||||||
BWZY_POINTER_SYMBOL=${BWZY_POINTER_SYMBOL:-> }
|
BWZY_POINTER_SYMBOL=${BWZY_POINTER_SYMBOL:-> }
|
||||||
BWZY_PROMPT_SYMBOL=${BWZY_PROMPT_SYMBOL:-? }
|
BWZY_PROMPT_SYMBOL=${BWZY_PROMPT_SYMBOL:-? }
|
||||||
BWZY_USER_SYMBOL=${BWZY_USER_SYMBOL:-u+}
|
BWZY_USER_SYMBOL=${BWZY_USER_SYMBOL:-u+}
|
||||||
|
|
@ -29,6 +27,9 @@ BWZY_FOLDER_SYMBOL=${BWZY_FOLDER_SYMBOL:-/}
|
||||||
export BWZY_COPY_CMD=${BWZY_COPY_CMD:-wl-copy}
|
export BWZY_COPY_CMD=${BWZY_COPY_CMD:-wl-copy}
|
||||||
export BWZY_TYPE_CMD=${BWZY_TYPE_CMD:-wtype}
|
export BWZY_TYPE_CMD=${BWZY_TYPE_CMD:-wtype}
|
||||||
|
|
||||||
|
# and the auto-completer itself
|
||||||
|
bwzy_autofill=${BWZY_AUTOFILL_HELPER:-"$(dirname "$0")/bwzy-autofill"}
|
||||||
|
|
||||||
read -r -d '' HELP_TEXT<<'EOH'
|
read -r -d '' HELP_TEXT<<'EOH'
|
||||||
bwzy is a fuzzy wrapper to the bitwarden cli
|
bwzy is a fuzzy wrapper to the bitwarden cli
|
||||||
|
|
||||||
|
|
@ -44,13 +45,13 @@ Usage:
|
||||||
EOH
|
EOH
|
||||||
|
|
||||||
# set some defaults to override based on options
|
# set some defaults to override based on options
|
||||||
CLEAR_CACHE='false'
|
|
||||||
SYNC_CACHE='false'
|
|
||||||
FORCE_SYNC='false'
|
|
||||||
DEBUG='false'
|
|
||||||
BWZY_OPTS=("${BWZY_DEFAULT_OPTS[@]}")
|
BWZY_OPTS=("${BWZY_DEFAULT_OPTS[@]}")
|
||||||
FILTER_ARG='-v' # argument to grep
|
CLEAR_CACHE='false'
|
||||||
|
DEBUG='false'
|
||||||
|
FORCE_SYNC='false'
|
||||||
ONESHOT='false'
|
ONESHOT='false'
|
||||||
|
SYNC_CACHE='false'
|
||||||
|
FILTER_ARG='-v' # argument to grep
|
||||||
|
|
||||||
# read in the options
|
# read in the options
|
||||||
while getopts "acdfhis1" o; do
|
while getopts "acdfhis1" o; do
|
||||||
|
|
@ -75,7 +76,12 @@ while getopts "acdfhis1" o; do
|
||||||
;;
|
;;
|
||||||
h)
|
h)
|
||||||
# show help and exit
|
# show help and exit
|
||||||
echo "$HELP_TEXT" | gum format
|
( echo "$HELP_TEXT"
|
||||||
|
echo -e "\n# active settings:"
|
||||||
|
echo '```bash'
|
||||||
|
set | grep '^BWZY_' | sort
|
||||||
|
echo '```'
|
||||||
|
) | bat -l markdown --plain
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
s)
|
s)
|
||||||
|
|
@ -177,7 +183,7 @@ fi
|
||||||
preview_item="$jq_select_id' < $items | json2yaml | bat --color=always -p -l yaml"
|
preview_item="$jq_select_id' < $items | json2yaml | bat --color=always -p -l yaml"
|
||||||
|
|
||||||
read -r -d '' fzf_header <<FZF_HEADER
|
read -r -d '' fzf_header <<FZF_HEADER
|
||||||
[a-/] preview on/off [a-w] preview wrap [a-?] this help
|
[a-.] preview on/off [a-/] preview wrap [a-?] this help
|
||||||
[a-u] copy username [a-p] copy password [a-t] copy totp
|
[a-u] copy username [a-p] copy password [a-t] copy totp
|
||||||
[a-l] copy link [enter] auto-fill [esc] clear/quit
|
[a-l] copy link [enter] auto-fill [esc] clear/quit
|
||||||
FZF_HEADER
|
FZF_HEADER
|
||||||
|
|
@ -202,8 +208,8 @@ jq -r '.[] | [ .id, .name, "`'"$BWZY_FOLDER_SYMBOL"'" + .folderId + "`" ] | join
|
||||||
--bind "alt-t:$copy_totp" \
|
--bind "alt-t:$copy_totp" \
|
||||||
--bind "alt-l:$copy_link" \
|
--bind "alt-l:$copy_link" \
|
||||||
--bind "enter:$auto_paste" \
|
--bind "enter:$auto_paste" \
|
||||||
--bind 'alt-/:toggle-preview' \
|
--bind 'alt-/:toggle-preview-wrap' \
|
||||||
--bind 'alt-w:toggle-preview-wrap' \
|
--bind 'alt-.:toggle-preview-wrap' \
|
||||||
--bind 'alt-?:toggle-header' \
|
--bind 'alt-?:toggle-header' \
|
||||||
--bind 'esc:cancel' \
|
--bind 'esc:cancel' \
|
||||||
--bind 'focus:transform-preview-label:echo {2} / {3}' \
|
--bind 'focus:transform-preview-label:echo {2} / {3}' \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue