mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-24 23:00:09 +00:00
Merge pull request #2242 from sztupy/fix-mvn-color-locale
Fix issues with special characters when running mvn
This commit is contained in:
commit
270b1dc689
1 changed files with 7 additions and 5 deletions
|
@ -24,16 +24,18 @@ export RESET_FORMATTING=`tput sgr0`
|
||||||
# Wrapper function for Maven's mvn command.
|
# Wrapper function for Maven's mvn command.
|
||||||
mvn-color()
|
mvn-color()
|
||||||
{
|
{
|
||||||
# Filter mvn output using sed
|
(
|
||||||
mvn $@ | sed -e "s/\(\[INFO\]\ \-.*\)/${TEXT_BLUE}${BOLD}\1/g" \
|
# Filter mvn output using sed. Before filtering set the locale to C, so invalid characters won't break some sed implementations
|
||||||
-e "s/\(\[INFO\]\ \[.*\)/${RESET_FORMATTING}${BOLD}\1${RESET_FORMATTING}/g" \
|
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/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \
|
||||||
-e "s/\(\[WARNING\].*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}/g" \
|
-e "s/\(\[WARNING\]\)\(.*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}\2/g" \
|
||||||
-e "s/\(\[ERROR\].*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}/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"
|
-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
|
# Make sure formatting is reset
|
||||||
echo -ne ${RESET_FORMATTING}
|
echo -ne ${RESET_FORMATTING}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Override the mvn command with the colorized one.
|
# Override the mvn command with the colorized one.
|
||||||
|
|
Loading…
Reference in a new issue