Skip to content

Commit db87307

Browse files
authored
Merge pull request #10 from viniciusam/color_console
Add support for colored output with -c parameter.
2 parents f93772a + 5acbe7e commit db87307

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ database - database to connect to.
5858
If not defined, then output will be displayed on screen, even if the parameter -s is not specified.
5959
If more than one -o parameter is specified for one -f parameter, the last one is taken into consideration.
6060
-s - Forces putting output to to screen for a given -f parameter.
61+
-c - If specified, enables printing of test results in colors as defined by ANSICONSOLE standards.
62+
Works only on reporeters that support colors (ut_documentation_reporter).
6163
```
6264

6365
Parameters -f, -o, -s are correlated. That is parameters -o and -s are controlling outputs for reporter specified by the preceding -f parameter.
@@ -80,3 +82,7 @@ utplsql run hr/hr@xe
8082
```
8183

8284
Invokes all unit test suites from schema "hr". Results are displayed to screen using default ut_documentation_reporter.
85+
86+
##### Enabling Color Outputs on Windows
87+
88+
To enable color outputs on Windows cmd you need to install an open-source utility called [ANSICON](http://adoxa.altervista.org/ansicon/).

src/main/java/io/github/utplsql/cli/RunCommand.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ public class RunCommand {
4444
"-f reporter_name [output_file] [console_output]")
4545
private List<String> reporterParams = new ArrayList<>();
4646

47+
@Parameter(
48+
names = {"-c", "--color"},
49+
description = "enables printing of test results in colors as defined by ANSICONSOLE standards")
50+
private boolean colorConsole = false;
51+
4752
public ConnectionInfo getConnectionInfo() {
4853
return connectionInfoList.get(0);
4954
}
@@ -81,11 +86,10 @@ public List<ReporterOptions> getReporterOptionsList() {
8186

8287
public void run() throws Exception {
8388
final ConnectionInfo ci = getConnectionInfo();
84-
System.out.println("Running Tests For: " + ci.toString());
8589

8690
final List<ReporterOptions> reporterOptionsList = getReporterOptionsList();
87-
final List<Reporter> reporterList = new ArrayList<>();
8891
final List<String> testPaths = getTestPaths();
92+
final List<Reporter> reporterList = new ArrayList<>();
8993

9094
if (testPaths.isEmpty()) testPaths.add(ci.getUser());
9195

@@ -109,6 +113,7 @@ public void run() throws Exception {
109113
new TestRunner()
110114
.addPathList(testPaths)
111115
.addReporterList(reporterList)
116+
.colorConsole(colorConsole)
112117
.run(conn);
113118
} catch (SQLException e) {
114119
// TODO

0 commit comments

Comments
 (0)