a54148a43e14f1ba8d4f602ce7d452111e70ad4d

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

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

Fixes #10260

Diff

 1diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
 2index c389fc963bc9ce2d33e292f8042604a1508e5872..b388b341d4deb00c876a268c772b5dffcd846029 100644
 3--- a/oh-my-zsh.sh
 4+++ b/oh-my-zsh.sh
 5@@ -2,14 +2,14 @@
 6 [ -n "$ZSH_VERSION" ] || {
 7   # ANSI formatting function (\033[<code>m)
 8   # 0: reset, 1: bold, 4: underline, 22: no bold, 24: no underline, 31: red, 33: yellow
 9-  f() {
10+  omz_f() {
11     [ $# -gt 0 ] || return
12     IFS=";" printf "\033[%sm" $*
13   }
14   # If stdout is not a terminal ignore all formatting
15-  [ -t 1 ] || f() { :; }
16+  [ -t 1 ] || omz_f() { :; }
17 
18-  ptree() {
19+  omz_ptree() {
20     # Get process tree of the current process
21     pid=$$; pids="$pid"
22     while [ ${pid-0} -ne 1 ] && ppid=$(ps -e -o pid,ppid | awk "\$1 == $pid { print \$2 }"); do
23@@ -28,11 +28,11 @@
24 
25   {
26     shell=$(ps -o pid,comm | awk "\$1 == $$ { print \$2 }")
27-    printf "$(f 1 31)Error:$(f 22) Oh My Zsh can't be loaded from: $(f 1)${shell}$(f 22). "
28-    printf "You need to run $(f 1)zsh$(f 22) instead.$(f 0)\n"
29-    printf "$(f 33)Here's the process tree:$(f 22)\n\n"
30-    ptree
31-    printf "$(f 0)\n"
32+    printf "$(omz_f 1 31)Error:$(omz_f 22) Oh My Zsh can't be loaded from: $(omz_f 1)${shell}$(omz_f 22). "
33+    printf "You need to run $(omz_f 1)zsh$(omz_f 22) instead.$(omz_f 0)\n"
34+    printf "$(omz_f 33)Here's the process tree:$(omz_f 22)\n\n"
35+    omz_ptree
36+    printf "$(omz_f 0)\n"
37   } >&2
38 
39   return 1