Browse Source

fix(init): rename function `f` due to clash with `f` alias (#10260)

Fixes #10260
pull/10263/head
Marc Cornellà 2 months ago
parent
commit
a54148a43e
No known key found for this signature in database GPG Key ID: 314585E776A9C1B
  1. 16
      oh-my-zsh.sh

16
oh-my-zsh.sh

@ -2,14 +2,14 @@
[ -n "$ZSH_VERSION" ] || {
# ANSI formatting function (\033[<code>m)
# 0: reset, 1: bold, 4: underline, 22: no bold, 24: no underline, 31: red, 33: yellow
f() {
omz_f() {
[ $# -gt 0 ] || return
IFS=";" printf "\033[%sm" $*
}
# If stdout is not a terminal ignore all formatting
[ -t 1 ] || f() { :; }
[ -t 1 ] || omz_f() { :; }
ptree() {
omz_ptree() {
# Get process tree of the current process
pid=$$; pids="$pid"
while [ ${pid-0} -ne 1 ] && ppid=$(ps -e -o pid,ppid | awk "\$1 == $pid { print \$2 }"); do
@ -28,11 +28,11 @@
{
shell=$(ps -o pid,comm | awk "\$1 == $$ { print \$2 }")
printf "$(f 1 31)Error:$(f 22) Oh My Zsh can't be loaded from: $(f 1)${shell}$(f 22). "
printf "You need to run $(f 1)zsh$(f 22) instead.$(f 0)\n"
printf "$(f 33)Here's the process tree:$(f 22)\n\n"
ptree
printf "$(f 0)\n"
printf "$(omz_f 1 31)Error:$(omz_f 22) Oh My Zsh can't be loaded from: $(omz_f 1)${shell}$(omz_f 22). "
printf "You need to run $(omz_f 1)zsh$(omz_f 22) instead.$(omz_f 0)\n"
printf "$(omz_f 33)Here's the process tree:$(omz_f 22)\n\n"
omz_ptree
printf "$(omz_f 0)\n"
} >&2
return 1

Loading…
Cancel
Save