Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
702a594d
Commit
702a594d
authored
Jun 08, 2019
by
Marc Cornellà
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
installer: don't rely on tput for coloring
tput is error-prone and may not be needed, since all the formatting codes used are standard across all types of terminals.
parent
d69bad8e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
12 deletions
+9
-12
install.sh
tools/install.sh
+9
-12
No files found.
tools/install.sh
View file @
702a594d
...
...
@@ -50,25 +50,22 @@ error() {
echo
${
RED
}
"Error:
$@
"
${
RESET
}
>
&2
}
# Set up color sequences
setup_color
()
{
ncolors
=
$(
tput colors 2>/dev/null
)
||
ncolors
=
0
# Only use colors if connected to a terminal that supports them
if
[
-t
1
]
&&
[
$ncolors
-ge
8
]
;
then
RED
=
"
$(
tput setaf 1
)
"
GREEN
=
"
$(
tput setaf 2
)
"
YELLOW
=
"
$(
tput setaf 3
)
"
BLUE
=
"
$(
tput setaf 4
)
"
BOLD
=
"
$(
tput bold
)
"
RESET
=
"
$(
tput sgr0
)
"
else
# Only use colors if connected to a terminal
if
[
-t
1
]
;
then
RED
=
$(
printf
'\033[31m'
)
GREEN
=
$(
printf
'\033[32m'
)
YELLOW
=
$(
printf
'\033[33m'
)
BLUE
=
$(
printf
'\033[34m'
)
BOLD
=
$(
printf
'\033[1m'
)
RESET
=
$(
printf
'\033[m'
)
else
RED
=
""
GREEN
=
""
YELLOW
=
""
BLUE
=
""
BOLD
=
""
RESET
=
""
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