diff options
author | Michal Čihař <michal@cihar.com> | 2016-03-18 11:10:04 +0100 |
---|---|---|
committer | Michal Čihař <michal@cihar.com> | 2016-03-18 11:10:04 +0100 |
commit | bc0fc19c67dab8759224d6323b477ea825843470 (patch) | |
tree | 72a17f9700a75dd487673b997793991190117ba3 | |
parent | 5987cda0ded12b258ca1fafcc71a45fbac63fe3e (diff) | |
download | sql-parser-bc0fc19c67dab8759224d6323b477ea825843470.zip sql-parser-bc0fc19c67dab8759224d6323b477ea825843470.tar.gz sql-parser-bc0fc19c67dab8759224d6323b477ea825843470.tar.bz2 |
Reset console formatting at the end of query
Signed-off-by: Michal Čihař <michal@cihar.com>
-rw-r--r-- | src/Utils/Formatter.php | 4 | ||||
-rw-r--r-- | tests/Utils/FormatterTest.php | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/Utils/Formatter.php b/src/Utils/Formatter.php index 2ac7e3b..56d4bcb 100644 --- a/src/Utils/Formatter.php +++ b/src/Utils/Formatter.php @@ -408,6 +408,10 @@ class Formatter $prev = $curr; } + if ($this->options['type'] === 'cli') { + return $ret . "\e[0m"; + } + return $ret; } diff --git a/tests/Utils/FormatterTest.php b/tests/Utils/FormatterTest.php index 1344257..4940016 100644 --- a/tests/Utils/FormatterTest.php +++ b/tests/Utils/FormatterTest.php @@ -75,7 +75,7 @@ class FormatTest extends TestCase ), array( 'SELECT 1', - "\x1b[35mSELECT\n \x1b[92m1", + "\x1b[35mSELECT\n \x1b[92m1\e[0m", 'cli' ), ); |