Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-build-utils
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
korinf
etersoft-build-utils
Commits
4714410e
Commit
4714410e
authored
Aug 22, 2015
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use colors for fatal, warning and info messages
parent
2bc03dfa
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
common
share/eterbuild/functions/common
+8
-2
No files found.
share/eterbuild/functions/common
View file @
4714410e
...
@@ -22,16 +22,18 @@ print_message()
...
@@ -22,16 +22,18 @@ print_message()
local
DESC
=
"
$1
"
local
DESC
=
"
$1
"
shift
shift
if
[
-z
"
$TEXTDOMAIN
"
]
;
then
if
[
-z
"
$TEXTDOMAIN
"
]
;
then
echo
"
$DESC
in
$(
basename
$0
)
:
$@
"
| colorify
>
&2
echo
"
$DESC
in
$(
basename
$0
)
:
$@
"
>
&2
else
else
echog
"
$DESC
in
$(
basename
$0
)
:
$@
"
| colorify
>
&2
echog
"
$DESC
in
$(
basename
$0
)
:
$@
"
>
&2
fi
fi
}
}
# Print error message and stop the program
# Print error message and stop the program
fatal
()
fatal
()
{
{
SETCOLOR_FAILURE
print_message Error
"
$@
"
print_message Error
"
$@
"
SETCOLOR_NORMAL
if
[
-n
"
$ETERSOFT_FATAL_REMOVE_FILES
"
]
;
then
if
[
-n
"
$ETERSOFT_FATAL_REMOVE_FILES
"
]
;
then
rm
-rvf
$ETERSOFT_FATAL_REMOVE_FILES
rm
-rvf
$ETERSOFT_FATAL_REMOVE_FILES
fi
fi
...
@@ -56,7 +58,9 @@ isatty2()
...
@@ -56,7 +58,9 @@ isatty2()
# Just print warning message
# Just print warning message
warning
()
warning
()
{
{
SETCOLOR_WARNING
print_message Warning
"
$@
"
print_message Warning
"
$@
"
SETCOLOR_NORMAL
}
}
info
()
info
()
...
@@ -66,7 +70,9 @@ info()
...
@@ -66,7 +70,9 @@ info()
# print message to stderr if stderr forwarded to (a file)
# print message to stderr if stderr forwarded to (a file)
if
isatty2
;
then
if
isatty2
;
then
isatty
||
return
0
isatty
||
return
0
SETCOLOR_WARNING
echo
"
$@
"
echo
"
$@
"
SETCOLOR_NORMAL
else
else
echo
"
$@
"
>
&2
echo
"
$@
"
>
&2
fi
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