Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
1fdd5351
Commit
1fdd5351
authored
May 21, 2019
by
Marc Cornellà
Browse files
installer: abstract error messages
parent
576499a5
Changes
1
Show whitespace changes
Inline
Side-by-side
tools/install.sh
View file @
1fdd5351
...
...
@@ -17,6 +17,10 @@ command_exists() {
command
-v
"
$@
"
>
/dev/null 2>&1
}
error
()
{
echo
"Error:
$@
"
>
&2
}
# Set up color sequences
setup_color
()
{
if
command_exists tput
;
then
...
...
@@ -54,20 +58,18 @@ setup_ohmyzsh() {
echo
"
${
BLUE
}
Cloning Oh My Zsh...
${
NORMAL
}
"
command_exists git
||
{
e
cho
"E
rror
:
git is not installed"
error
"
git is not installed"
exit
1
}
if
[
"
$OSTYPE
"
=
cygwin
]
&&
git
--version
|
grep
-q
msysgit
;
then
cat
<<-
EOF
Error: Windows/MSYS Git is not supported on Cygwin
Error: Make sure the Cygwin git package is installed and is first on the
$PATH
EOF
error
"Windows/MSYS Git is not supported on Cygwin"
error
"Make sure the Cygwin git package is installed and is first on the
\$
PATH"
exit
1
fi
git clone
--depth
=
1 https://github.com/robbyrussell/oh-my-zsh.git
"
$ZSH
"
||
{
e
cho
"E
rror
:
git clone of oh-my-zsh repo failed"
error
"
git clone of oh-my-zsh repo failed"
exit
1
}
}
...
...
@@ -96,7 +98,7 @@ setup_shell() {
if
command_exists chsh
;
then
echo
"
${
BLUE
}
Time to change your default shell to zsh!
${
NORMAL
}
"
if
!
chsh
-s
$(
grep
/zsh
$
/etc/shells |
tail
-1
)
;
then
e
cho
"E
rror
:
chsh command unsuccessful. Change your default shell manually."
error
"
chsh command unsuccessful. Change your default shell manually."
fi
# Else, suggest the user do so manually.
else
...
...
@@ -119,7 +121,7 @@ main() {
if
[
-d
"
$ZSH
"
]
;
then
cat
<<-
EOF
${
YELLOW
}
You already have Oh My Zsh installed.
${
NORMAL
}
You'll need to remove
$ZSH
if you want to reinstall.
You'll need to remove
'
$ZSH
'
if you want to reinstall.
EOF
exit
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