From a54148a43e14f1ba8d4f602ce7d452111e70ad4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 4 Oct 2021 17:51:22 +0200 Subject: [PATCH] fix(init): rename function `f` due to clash with `f` alias (#10260) Fixes #10260 --- oh-my-zsh.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c389fc963..b388b341d 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -2,14 +2,14 @@ [ -n "$ZSH_VERSION" ] || { # ANSI formatting function (\033[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