Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
97134d1e
Unverified
Commit
97134d1e
authored
Aug 02, 2022
by
Ben Walton
Committed by
GitHub
Aug 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(cli): make `omz` honour symlinks when changing `.zshrc` (#11082)
parent
0346cdf7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
cli.zsh
lib/cli.zsh
+15
-15
No files found.
lib/cli.zsh
View file @
97134d1e
...
...
@@ -280,9 +280,10 @@ multi == 1 && length(\$0) > 0 {
"
local
zdot
=
"
${
ZDOTDIR
:-
$HOME
}
"
awk
"
$awk_script
"
"
$zdot
/.zshrc"
>
"
$zdot
/.zshrc.new"
\
&&
command mv
-f
"
$zdot
/.zshrc"
"
$zdot
/.zshrc.bck"
\
&&
command mv
-f
"
$zdot
/.zshrc.new"
"
$zdot
/.zshrc"
local
zshrc
=
"
${${:-
"
${
zdot
}
/.zshrc"
}
:A
}
"
awk
"
$awk_script
"
"
$zshrc
"
>
"
$zdot
/.zshrc.new"
\
&&
command cp
-f
"
$zshrc
"
"
$zdot
/.zshrc.bck"
\
&&
command mv
-f
"
$zdot
/.zshrc.new"
"
$zshrc
"
# Exit if the new .zshrc file wasn't created correctly
[[
$?
-eq
0
]]
||
{
...
...
@@ -294,8 +295,7 @@ multi == 1 && length(\$0) > 0 {
# Exit if the new .zshrc file has syntax errors
if
!
command
zsh
-n
"
$zdot
/.zshrc"
;
then
_omz::log error
"broken syntax in '"
${
zdot
/#
$HOME
/\~
}
/.zshrc
"'. Rolling back changes..."
command mv
-f
"
$zdot
/.zshrc"
"
$zdot
/.zshrc.new"
command mv
-f
"
$zdot
/.zshrc.bck"
"
$zdot
/.zshrc"
command mv
-f
"
$zdot
/.zshrc.bck"
"
$zshrc
"
return
1
fi
...
...
@@ -354,9 +354,10 @@ multi == 1 && /^[^#]*\)/ {
"
local
zdot
=
"
${
ZDOTDIR
:-
$HOME
}
"
awk
"
$awk_script
"
"
$zdot
/.zshrc"
>
"
$zdot
/.zshrc.new"
\
&&
command mv
-f
"
$zdot
/.zshrc"
"
$zdot
/.zshrc.bck"
\
&&
command mv
-f
"
$zdot
/.zshrc.new"
"
$zdot
/.zshrc"
local
zshrc
=
"
${${:-
"
${
zdot
}
/.zshrc"
}
:A
}
"
awk
"
$awk_script
"
"
$zshrc
"
>
"
$zdot
/.zshrc.new"
\
&&
command cp
-f
"
$zshrc
"
"
$zdot
/.zshrc.bck"
\
&&
command mv
-f
"
$zdot
/.zshrc.new"
"
$zshrc
"
# Exit if the new .zshrc file wasn't created correctly
[[
$?
-eq
0
]]
||
{
...
...
@@ -368,8 +369,7 @@ multi == 1 && /^[^#]*\)/ {
# Exit if the new .zshrc file has syntax errors
if
!
command
zsh
-n
"
$zdot
/.zshrc"
;
then
_omz::log error
"broken syntax in '"
${
zdot
/#
$HOME
/\~
}
/.zshrc
"'. Rolling back changes..."
command mv
-f
"
$zdot
/.zshrc"
"
$zdot
/.zshrc.new"
command mv
-f
"
$zdot
/.zshrc.bck"
"
$zdot
/.zshrc"
command mv
-f
"
$zdot
/.zshrc.bck"
"
$zshrc
"
return
1
fi
...
...
@@ -715,7 +715,8 @@ END {
'
local
zdot
=
"
${
ZDOTDIR
:-
$HOME
}
"
awk
"
$awk_script
"
"
$zdot
/.zshrc"
>
"
$zdot
/.zshrc.new"
\
local
zshrc
=
"
${${:-
"
${
zdot
}
/.zshrc"
}
:A
}
"
awk
"
$awk_script
"
"
$zshrc
"
>
"
$zdot
/.zshrc.new"
\
||
{
# Prepend ZSH_THEME= line to .zshrc if it doesn't exist
cat
<<
EOF
...
...
@@ -724,8 +725,8 @@ ZSH_THEME="$1" # set by \`omz\`
EOF
cat
"
$zdot
/.zshrc"
}
>
"
$zdot
/.zshrc.new"
\
&&
command
mv
-f
"
$zdot
/.
zshrc"
"
$zdot
/.zshrc.bck"
\
&&
command mv
-f
"
$zdot
/.zshrc.new"
"
$z
dot
/.z
shrc"
&&
command
cp
-f
"
$
zshrc
"
"
$zdot
/.zshrc.bck"
\
&&
command mv
-f
"
$zdot
/.zshrc.new"
"
$zshrc
"
# Exit if the new .zshrc file wasn't created correctly
[[
$?
-eq
0
]]
||
{
...
...
@@ -737,8 +738,7 @@ EOF
# Exit if the new .zshrc file has syntax errors
if
!
command
zsh
-n
"
$zdot
/.zshrc"
;
then
_omz::log error
"broken syntax in '"
${
zdot
/#
$HOME
/\~
}
/.zshrc
"'. Rolling back changes..."
command mv
-f
"
$zdot
/.zshrc"
"
$zdot
/.zshrc.new"
command mv
-f
"
$zdot
/.zshrc.bck"
"
$zdot
/.zshrc"
command mv
-f
"
$zdot
/.zshrc.bck"
"
$zshrc
"
return
1
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment