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
270b1dc6
Commit
270b1dc6
authored
Dec 01, 2013
by
Robby Russell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2242 from sztupy/fix-mvn-color-locale
Fix issues with special characters when running mvn
parents
1b337af7
96798c42
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
mvn.plugin.zsh
plugins/mvn/mvn.plugin.zsh
+7
-5
No files found.
plugins/mvn/mvn.plugin.zsh
View file @
270b1dc6
...
...
@@ -24,16 +24,18 @@ export RESET_FORMATTING=`tput sgr0`
# Wrapper function for Maven's mvn command.
mvn-color
()
{
# Filter mvn output using sed
mvn
$@
|
sed
-e
"s/
\(\[
INFO
\]\ \-
.*
\)
/
${
TEXT_BLUE
}${
BOLD
}
\1
/g"
\
-e
"s/
\(\[
INFO
\]\ \[
.*
\)
/
${
RESET_FORMATTING
}${
BOLD
}
\1
${
RESET_FORMATTING
}
/g"
\
(
# Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations
unset
LANG
LC_CTYPE
=
C mvn
$@
|
sed
-e
"s/
\(\[
INFO
\]\)\(
.*
\)
/
${
TEXT_BLUE
}${
BOLD
}
\1
${
RESET_FORMATTING
}
\2
/g"
\
-e
"s/
\(\[
INFO
\]\
BUILD SUCCESSFUL
\)
/
${
BOLD
}${
TEXT_GREEN
}
\1
${
RESET_FORMATTING
}
/g"
\
-e
"s/
\(\[
WARNING
\]
.*
\)
/
${
BOLD
}${
TEXT_YELLOW
}
\1
${
RESET_FORMATTING
}
/g"
\
-e
"s/
\(\[
ERROR
\]
.*
\)
/
${
BOLD
}${
TEXT_RED
}
\1
${
RESET_FORMATTING
}
/g"
\
-e
"s/
\(\[
WARNING
\]
\)\(
.*
\)
/
${
BOLD
}${
TEXT_YELLOW
}
\1
${
RESET_FORMATTING
}
\2
/g"
\
-e
"s/
\(\[
ERROR
\]
\)\(
.*
\)
/
${
BOLD
}${
TEXT_RED
}
\1
${
RESET_FORMATTING
}
\2
/g"
\
-e
"s/Tests run:
\(
[^,]*
\)
, Failures:
\(
[^,]*
\)
, Errors:
\(
[^,]*
\)
, Skipped:
\(
[^,]*
\)
/
${
BOLD
}${
TEXT_GREEN
}
Tests run:
\1
${
RESET_FORMATTING
}
, Failures:
${
BOLD
}${
TEXT_RED
}
\2
${
RESET_FORMATTING
}
, Errors:
${
BOLD
}${
TEXT_RED
}
\3
${
RESET_FORMATTING
}
, Skipped:
${
BOLD
}${
TEXT_YELLOW
}
\4
${
RESET_FORMATTING
}
/g"
# Make sure formatting is reset
echo
-ne
${
RESET_FORMATTING
}
)
}
# Override the mvn command with the colorized one.
...
...
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