mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-08-07 06:08:39 +02:00
fix: misc bugfixes across lib, plugins, and tools
- fix(cli): fix omz pr test subshell variable scope issue - fix(functions): fix takezip parsing wrong line from unzip -l output - fix(history): handle empty HISTSIZE/SAVEHIST to prevent comparison error - fix(git): add version guard for gclf alias (--also-filter-submodules) - fix(macos/spotify): fix typo USER_CONFG_FILE -> USER_CONFIG_FILE - fix(docker): handle empty container list in dsta alias - fix(npm): replace deprecated npm bin with npm prefix in npmE alias - fix(kubectl): add kgen alias using .metadata.creationTimestamp - fix(grep): rename GREP_OPTIONS to local variable grep_opts - fix(theme-and-appearance): fix OpenBSD ls alias order to match comment
This commit is contained in:
parent
677a4592b1
commit
d6c14ecdbd
10 changed files with 26 additions and 16 deletions
|
|
@ -615,12 +615,13 @@ function _omz::pr::test {
|
||||||
builtin cd -q "$ZSH"
|
builtin cd -q "$ZSH"
|
||||||
|
|
||||||
# Get the ohmyzsh git remote
|
# Get the ohmyzsh git remote
|
||||||
command git remote -v | while read remote url _; do
|
local found=0
|
||||||
|
while read remote url _; do
|
||||||
case "$url" in
|
case "$url" in
|
||||||
https://github.com/ohmyzsh/ohmyzsh(|.git)) found=1; break ;;
|
https://github.com/ohmyzsh/ohmyzsh(|.git)) found=1; break ;;
|
||||||
git@github.com:ohmyzsh/ohmyzsh(|.git)) found=1; break ;;
|
git@github.com:ohmyzsh/ohmyzsh(|.git)) found=1; break ;;
|
||||||
esac
|
esac
|
||||||
done
|
done <<< "$(command git remote -v)"
|
||||||
|
|
||||||
(( $found )) || {
|
(( $found )) || {
|
||||||
_omz::log error "could not find the ohmyzsh git remote. Aborting..."
|
_omz::log error "could not find the ohmyzsh git remote. Aborting..."
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,9 @@ function takezip() {
|
||||||
data="$(mktemp)"
|
data="$(mktemp)"
|
||||||
curl -L "$1" > "$data"
|
curl -L "$1" > "$data"
|
||||||
unzip "$data" -d "./"
|
unzip "$data" -d "./"
|
||||||
thedir="$(unzip -l "$data" | awk 'NR==4 {print $4}' | sed 's/\/.*//')"
|
# Parse the first actual file entry from unzip -l output, skipping header lines and separators
|
||||||
|
thedir="$(unzip -l "$data" | awk 'NR>3 && !/^-/ && NF>=4 {print $4; exit}')"
|
||||||
|
thedir="${thedir%%/*}"
|
||||||
rm "$data"
|
rm "$data"
|
||||||
cd "$thedir"
|
cd "$thedir"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
lib/grep.zsh
12
lib/grep.zsh
|
|
@ -10,20 +10,21 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ignore these folders (if the necessary grep flags are available)
|
# Ignore these folders (if the necessary grep flags are available)
|
||||||
EXC_FOLDERS="{.bzr,CVS,.git,.hg,.svn,.idea,.tox,.venv,venv}"
|
local EXC_FOLDERS="{.bzr,CVS,.git,.hg,.svn,.idea,.tox,.venv,venv}"
|
||||||
|
local grep_opts
|
||||||
|
|
||||||
# Check for --exclude-dir, otherwise check for --exclude. If --exclude
|
# Check for --exclude-dir, otherwise check for --exclude. If --exclude
|
||||||
# isn't available, --color won't be either (they were released at the same
|
# isn't available, --color won't be either (they were released at the same
|
||||||
# time (v2.5): https://git.savannah.gnu.org/cgit/grep.git/tree/NEWS?id=1236f007
|
# time (v2.5): https://git.savannah.gnu.org/cgit/grep.git/tree/NEWS?id=1236f007
|
||||||
if grep-flags-available --color=auto --exclude-dir=.cvs; then
|
if grep-flags-available --color=auto --exclude-dir=.cvs; then
|
||||||
GREP_OPTIONS="--color=auto --exclude-dir=$EXC_FOLDERS"
|
grep_opts="--color=auto --exclude-dir=$EXC_FOLDERS"
|
||||||
elif grep-flags-available --color=auto --exclude=.cvs; then
|
elif grep-flags-available --color=auto --exclude=.cvs; then
|
||||||
GREP_OPTIONS="--color=auto --exclude=$EXC_FOLDERS"
|
grep_opts="--color=auto --exclude=$EXC_FOLDERS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$GREP_OPTIONS" ]]; then
|
if [[ -n "$grep_opts" ]]; then
|
||||||
# export grep, egrep and fgrep settings
|
# export grep, egrep and fgrep settings
|
||||||
alias grep="grep $GREP_OPTIONS"
|
alias grep="grep $grep_opts"
|
||||||
alias egrep="grep -E"
|
alias egrep="grep -E"
|
||||||
alias fgrep="grep -F"
|
alias fgrep="grep -F"
|
||||||
|
|
||||||
|
|
@ -34,7 +35,6 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
unset GREP_OPTIONS EXC_FOLDERS
|
|
||||||
unfunction grep-flags-available
|
unfunction grep-flags-available
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ esac
|
||||||
|
|
||||||
## History file configuration
|
## History file configuration
|
||||||
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
|
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
|
||||||
[ "$HISTSIZE" -lt 50000 ] && HISTSIZE=50000
|
[ -z "$HISTSIZE" ] || [ "$HISTSIZE" -lt 50000 ] && HISTSIZE=50000
|
||||||
[ "$SAVEHIST" -lt 10000 ] && SAVEHIST=10000
|
[ -z "$SAVEHIST" ] || [ "$SAVEHIST" -lt 10000 ] && SAVEHIST=10000
|
||||||
|
|
||||||
## History command configuration
|
## History command configuration
|
||||||
setopt extended_history # record timestamp of command in HISTFILE
|
setopt extended_history # record timestamp of command in HISTFILE
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,8 @@ case "$OSTYPE" in
|
||||||
# with color and multibyte support) are available from ports.
|
# with color and multibyte support) are available from ports.
|
||||||
# `colorls` will be installed on purpose and can't be pulled in by installing
|
# `colorls` will be installed on purpose and can't be pulled in by installing
|
||||||
# coreutils (which might be installed for ), so prefer it to `gls`.
|
# coreutils (which might be installed for ), so prefer it to `gls`.
|
||||||
test-ls-args gls --color && alias ls='gls --color=tty'
|
|
||||||
test-ls-args colorls -G && alias ls='colorls -G'
|
test-ls-args colorls -G && alias ls='colorls -G'
|
||||||
|
test-ls-args gls --color && alias ls='gls --color=tty'
|
||||||
;;
|
;;
|
||||||
(darwin|freebsd)*)
|
(darwin|freebsd)*)
|
||||||
# This alias works by default just using $LSCOLORS
|
# This alias works by default just using $LSCOLORS
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ alias 'drm!'='docker container rm -f'
|
||||||
alias dsprune='docker system prune'
|
alias dsprune='docker system prune'
|
||||||
alias dst='docker container start'
|
alias dst='docker container start'
|
||||||
alias drs='docker container restart'
|
alias drs='docker container restart'
|
||||||
alias dsta='docker stop $(docker ps -q)'
|
alias dsta='docker ps -q | xargs -r docker stop'
|
||||||
alias dstp='docker container stop'
|
alias dstp='docker container stop'
|
||||||
alias dsts='docker stats'
|
alias dsts='docker stats'
|
||||||
alias dtop='docker top'
|
alias dtop='docker top'
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,12 @@ alias gcpa='git cherry-pick --abort'
|
||||||
alias gcpc='git cherry-pick --continue'
|
alias gcpc='git cherry-pick --continue'
|
||||||
alias gclean='git clean --interactive -d'
|
alias gclean='git clean --interactive -d'
|
||||||
alias gcl='git clone --recurse-submodules'
|
alias gcl='git clone --recurse-submodules'
|
||||||
|
# gclf: clone with --filter and --shallow-submodules, requires Git >= 2.36 for --also-filter-submodules
|
||||||
|
if is-at-least 2.36.0 "$git_version"; then
|
||||||
alias gclf='git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules'
|
alias gclf='git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules'
|
||||||
|
else
|
||||||
|
alias gclf='git clone --recursive --shallow-submodules --filter=blob:none'
|
||||||
|
fi
|
||||||
|
|
||||||
function gccd() {
|
function gccd() {
|
||||||
setopt localoptions extendedglob
|
setopt localoptions extendedglob
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,8 @@ alias kdelf='kubectl delete -f'
|
||||||
alias kdelk='kubectl delete -k'
|
alias kdelk='kubectl delete -k'
|
||||||
alias kge='kubectl get events --sort-by=".lastTimestamp"'
|
alias kge='kubectl get events --sort-by=".lastTimestamp"'
|
||||||
alias kgew='kubectl get events --sort-by=".lastTimestamp" --watch'
|
alias kgew='kubectl get events --sort-by=".lastTimestamp" --watch'
|
||||||
|
alias kgen='kubectl get events --sort-by=".metadata.creationTimestamp"'
|
||||||
|
alias kgenw='kubectl get events --sort-by=".metadata.creationTimestamp" --watch'
|
||||||
|
|
||||||
# Pod management.
|
# Pod management.
|
||||||
alias kgp='kubectl get pods'
|
alias kgp='kubectl get pods'
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ while [ $# -gt 0 ]; do
|
||||||
-d "grant_type=client_credentials" \
|
-d "grant_type=client_credentials" \
|
||||||
)
|
)
|
||||||
if ! [[ "${SPOTIFY_TOKEN_RESPONSE_DATA}" =~ "access_token" ]]; then
|
if ! [[ "${SPOTIFY_TOKEN_RESPONSE_DATA}" =~ "access_token" ]]; then
|
||||||
cecho "Authorization failed, please check ${USER_CONFG_FILE}"
|
cecho "Authorization failed, please check ${USER_CONFIG_FILE}"
|
||||||
cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}"
|
cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}"
|
||||||
showAPIHelp
|
showAPIHelp
|
||||||
return 1
|
return 1
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ alias npmF='npm i -f'
|
||||||
|
|
||||||
# Execute command from node_modules folder based on current directory
|
# Execute command from node_modules folder based on current directory
|
||||||
# i.e npmE gulp
|
# i.e npmE gulp
|
||||||
alias npmE='PATH="$(npm bin)":"$PATH"'
|
alias npmE='PATH="$(npm prefix)/node_modules/.bin":"$PATH"'
|
||||||
|
|
||||||
# Check which npm modules are outdated
|
# Check which npm modules are outdated
|
||||||
alias npmO="npm outdated"
|
alias npmO="npm outdated"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue