Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next 240224 #97

Merged
merged 2 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
*.fish text eol=lf
*.sh text eol=lf
*.zsh text eol=lf
functions/.* text eol=lf
functions/* text eol=lf

# These are explicitly windows files and should use crlf
*.bat text eol=crlf
*.cmd text eol=crlf
Expand Down
4 changes: 2 additions & 2 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ lint:
disabled:
- checkov
- yamllint
- trufflehog
- trivy
enabled:
- [email protected]
- [email protected]
- [email protected]
- git-diff-check
- [email protected]
Expand Down
5 changes: 2 additions & 3 deletions functions/.zi-prepare-zoxide
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
# Zsh Plugin Standard
# https://wiki.zshell.dev/community/zsh_plugin_standard#standard-recommended-options
builtin emulate -L zsh ${=${options[xtrace]:#off}:+-o xtrace}
builtin setopt extended_glob warn_create_global \
typeset_silent no_short_loops rc_quotes no_auto_pushd
builtin setopt extended_glob typeset_silent no_short_loops rc_quotes no_auto_pushd

integer ret=0
typeset -i ret=0

# The directory in which the database is stored.
if [[ ! -d ${ZPFX}/share ]]; then
Expand Down
6 changes: 2 additions & 4 deletions functions/.zsh-prepare-zoxide
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#autoload
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
#
Expand All @@ -9,10 +8,9 @@
# Zsh Plugin Standard
# https://wiki.zshell.dev/community/zsh_plugin_standard#standard-recommended-options
builtin emulate -L zsh ${=${options[xtrace]:#off}:+-o xtrace}
builtin setopt extended_glob warn_create_global typeset_silent \
no_short_loops rc_quotes no_auto_pushd
builtin setopt extended_glob typeset_silent no_short_loops rc_quotes no_auto_pushd

integer ret=0
typeset -i ret=0

# Check dependencies
typeset -a dependencies
Expand Down
12 changes: 5 additions & 7 deletions functions/@zsh-eval-cache
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@
# vim: ft=zsh sw=2 ts=2 et

builtin emulate -L zsh ${=${options[xtrace]:#off}:+-o xtrace}
builtin setopt extended_glob warn_create_global typeset_silent \
no_short_loops rc_quotes no_auto_pushd local_options
builtin setopt extended_glob typeset_silent no_short_loops rc_quotes no_auto_pushd local_options

typeset -gA ZEC
typeset -i ret=0
typeset -a input_array=( "$@" )
typeset -ga chpwd_functions __zoxide_z_prefix

: ${ZEC[CACHE_DIR]:=${ZEC[CACHE_DIR]:-${Plugins[ZSH_ZOXIDE]}/._zoxide}}
: ${ZEC[DISABLED]:=${ZEC[DISABLED]:-0}}
: ${ZEC[DEBUG]:=${ZEC[DEBUG]:-0}}
: ${ZEC[MAX]:=${ZEC[MAX]:-1000}}

ZEC[CACHE_DIR]=${~ZEC[CACHE_DIR]}
[[ -d $ZEC[CACHE_DIR] ]] || command mkdir -p $ZEC[CACHE_DIR] &> /dev/null
[[ -d ${ZEC[CACHE_DIR]} ]] || command mkdir -p ${ZEC[CACHE_DIR]} &> /dev/null

if (( $+commands[md5] )); then
ZEC[MD5_HASH]=$(md5 <<< $input_array)
Expand All @@ -32,7 +30,7 @@ fi
if (( ZEC[DISABLED] )); then
(( ZEC[DEBUG] )) && builtin print -Pr "@zsh-eval-cache: disabled"
eval "$( ${(@)input_array} )"; ret=$?
elif [[ -s $ZEC[CACHE] ]]; then
elif [[ -s ${ZEC[CACHE]} ]]; then
[[ -f $ZEC[COUNT] ]] || { builtin print 1 > ${ZEC[COUNT]}; } 2> /dev/null

typeset count=$(<${ZEC[COUNT]})
Expand All @@ -49,10 +47,10 @@ else

(( ZEC[DEBUG] )) && builtin print -Pr "@zsh-eval-cache: miss"

${(@)input_array} >! $ZEC[CACHE] && zcompile -U $ZEC[CACHE] && builtin source $ZEC[CACHE]; ret=$?
${(@)input_array} >! ${ZEC[CACHE]} && zcompile -U ${ZEC[CACHE]} && builtin source ${ZEC[CACHE]}; ret=$?
fi

(( count > ZEC[MAX] )) && command rm -rf $ZEC[CACHE_DIR] &> /dev/null
(( count > ZEC[MAX] )) && command rm -rf ${ZEC[CACHE_DIR]} &> /dev/null

(( ret )) && builtin print -Pr "@zsh-eval-cache: failed to initialize zoxide" >&2

Expand Down
Loading