style(1password): ensure function definitions meet style guide

- have both leading `function` declarations and parenthesis at the end
This commit is contained in:
James Neill 2024-12-26 03:26:32 +00:00
parent f47ea3f003
commit 5b5286106e
No known key found for this signature in database
1 changed files with 5 additions and 5 deletions

View File

@ -22,28 +22,28 @@ OP_RUN_WRAPPER_SYMBOL="🔑"
# Currently we take a simple approach and set aliases to override each command, this could be done with functions instead # Currently we take a simple approach and set aliases to override each command, this could be done with functions instead
# Also ignoring the option to specify specific environment files with the `--env-file` flag # Also ignoring the option to specify specific environment files with the `--env-file` flag
set_op_aliases() { function set_op_aliases() {
for cmd in "${OP_RUN_WRAPPER_CMDS[@]}"; do for cmd in "${OP_RUN_WRAPPER_CMDS[@]}"; do
alias "$cmd"="op run -- $cmd" alias "$cmd"="op run -- $cmd"
done done
} }
unset_op_aliases() { function unset_op_aliases() {
for cmd in "${OP_RUN_WRAPPER_CMDS[@]}"; do for cmd in "${OP_RUN_WRAPPER_CMDS[@]}"; do
unalias "$cmd" 2>/dev/null unalias "$cmd" 2>/dev/null
done done
} }
set_prompt() { function set_prompt() {
OP_RUN_WRAPPER_ORIGINAL_PROMPT=$PROMPT OP_RUN_WRAPPER_ORIGINAL_PROMPT=$PROMPT
export PROMPT="(${OP_RUN_WRAPPER_SYMBOL}) ${PROMPT}" export PROMPT="(${OP_RUN_WRAPPER_SYMBOL}) ${PROMPT}"
} }
unset_prompt() { function unset_prompt() {
export PROMPT="${OP_RUN_WRAPPER_ORIGINAL_PROMPT}" export PROMPT="${OP_RUN_WRAPPER_ORIGINAL_PROMPT}"
} }
toggle_secrets_injection() { function toggle_secrets_injection() {
if [[ -z "${OP_RUN_WRAPPER_CMDS[*]}" ]]; then if [[ -z "${OP_RUN_WRAPPER_CMDS[*]}" ]]; then
echo "Error: OP_RUN_WRAPPER_CMDS is empty, please update the list of commands which require secrets injection." echo "Error: OP_RUN_WRAPPER_CMDS is empty, please update the list of commands which require secrets injection."
zle reset-prompt zle reset-prompt