Skip to content

Commit 1b65b51

Browse files
committed
Refactor: getCommand() no longer needed
1 parent 09bf357 commit 1b65b51

File tree

4 files changed

+12
-20
lines changed

4 files changed

+12
-20
lines changed
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package org.utplsql.cli;
22

3-
/** Interface to decouple JCommander commands
3+
/** This is the very basic interface that should be implemented by all utPLSQL cli commands
44
*
55
* @author pesse
66
*/
77
public interface ICommand {
8-
int run();
98

10-
String getCommand();
9+
/** We expect the command to handle all eventually occuring exceptions
10+
* and return an exit code
11+
*
12+
* @return exit code integer
13+
*/
14+
int run();
1115
}

src/main/java/org/utplsql/cli/ReportersCommand.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
import org.utplsql.api.reporter.inspect.ReporterInfo;
77
import org.utplsql.api.reporter.inspect.ReporterInspector;
88
import org.utplsql.cli.exception.DatabaseConnectionFailed;
9-
import picocli.CommandLine.*;
9+
import picocli.CommandLine.Command;
10+
import picocli.CommandLine.Parameters;
1011

1112
import javax.sql.DataSource;
1213
import java.io.PrintStream;
1314
import java.sql.Connection;
14-
import java.util.*;
15+
import java.util.Arrays;
16+
import java.util.Comparator;
17+
import java.util.List;
1518

1619
@Command( name = "reporters", description = "prints a list of reporters available in the specified database")
1720
public class ReportersCommand implements ICommand {
@@ -43,11 +46,6 @@ public int run() {
4346
return 0;
4447
}
4548

46-
@Override
47-
public String getCommand() {
48-
return "reporters";
49-
}
50-
5149
private void writeReporters(List<ReporterInfo> reporterInfos, PrintStream out) {
5250
reporterInfos.stream()
5351
.sorted(Comparator.comparing(ReporterInfo::getName))

src/main/java/org/utplsql/cli/RunPicocliCommand.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,6 @@ public int run() {
249249
return getRunAction().run();
250250
}
251251

252-
@Override
253-
public String getCommand() {
254-
return null;
255-
}
256-
257252
@Override
258253
public TestRunner newTestRunner(List<Reporter> reporterList) {
259254
return getRunAction().newTestRunner(reporterList);

src/main/java/org/utplsql/cli/VersionInfoCommand.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,4 @@ private void writeUtPlsqlVersion( String connectString ) throws SQLException {
4848
}
4949
}
5050
}
51-
52-
@Override
53-
public String getCommand() {
54-
return "info";
55-
}
5651
}

0 commit comments

Comments
 (0)