File tree Expand file tree Collapse file tree 4 files changed +49
-1
lines changed
main/java/org/utplsql/cli
test/java/org/utplsql/cli Expand file tree Collapse file tree 4 files changed +49
-1
lines changed Original file line number Diff line number Diff line change @@ -55,10 +55,20 @@ ALTER SESSION SET NLS_TERRITORY='AMERICA';
55
55
```
56
56
57
57
## Usage
58
- Currently, utPLSQL-cli supports the following commands:
58
+ Currently, utPLSQL-cli supports the following sub- commands:
59
59
- run
60
60
- info
61
61
- reporters
62
+ - help
63
+
64
+ To get more info about a command, use
65
+ ```
66
+ utplsql <sub-command> -h
67
+ ```
68
+ Example:
69
+ ```
70
+ utplsql run -h
71
+ ```
62
72
63
73
#### \< ConnectionURL>
64
74
Original file line number Diff line number Diff line change 7
7
import org .utplsql .api .reporter .inspect .ReporterInspector ;
8
8
import org .utplsql .cli .exception .DatabaseConnectionFailed ;
9
9
import picocli .CommandLine .Command ;
10
+ import picocli .CommandLine .Option ;
10
11
import picocli .CommandLine .Parameters ;
11
12
12
13
import javax .sql .DataSource ;
@@ -22,6 +23,9 @@ public class ReportersCommand implements ICommand {
22
23
@ Parameters (description = UtplsqlPicocliCommand .COMMANDLINE_PARAM_DESCRIPTION , arity = "1" )
23
24
private String connectionString ;
24
25
26
+ @ Option (names = "-h" , usageHelp = true , description = "display this help and exit" )
27
+ boolean help ;
28
+
25
29
@ Override
26
30
public int run () {
27
31
Original file line number Diff line number Diff line change 6
6
import org .utplsql .api .db .DefaultDatabaseInformation ;
7
7
import org .utplsql .api .exception .UtPLSQLNotInstalledException ;
8
8
import picocli .CommandLine .Command ;
9
+ import picocli .CommandLine .Option ;
9
10
import picocli .CommandLine .Parameters ;
10
11
11
12
import javax .sql .DataSource ;
@@ -18,6 +19,9 @@ public class VersionInfoCommand implements ICommand {
18
19
@ Parameters (description = UtplsqlPicocliCommand .COMMANDLINE_PARAM_DESCRIPTION , arity = "0..1" )
19
20
private String connectionString ;
20
21
22
+ @ Option (names = "-h" , usageHelp = true , description = "display this help and exit" )
23
+ boolean help ;
24
+
21
25
public int run () {
22
26
23
27
System .out .println (CliVersionInfo .getInfo ());
Original file line number Diff line number Diff line change @@ -20,6 +20,36 @@ void show_basic_help_on_help_command() {
20
20
assertTrue (output .contains ("Usage:" ));
21
21
}
22
22
23
+ @ Test
24
+ void show_help_for_run_command () {
25
+ capturer = new SystemCapturer .SystemOutCapturer ();
26
+ capturer .start ();
27
+ TestHelper .runApp ("run" , "-h" );
28
+ String output = capturer .stop ();
29
+
30
+ assertTrue (output .contains ("Usage:" ));
31
+ }
32
+
33
+ @ Test
34
+ void show_help_for_reporters_command () {
35
+ capturer = new SystemCapturer .SystemOutCapturer ();
36
+ capturer .start ();
37
+ TestHelper .runApp ("reporters" , "-h" );
38
+ String output = capturer .stop ();
39
+
40
+ assertTrue (output .contains ("Usage:" ));
41
+ }
42
+
43
+ @ Test
44
+ void show_help_for_info_command () {
45
+ capturer = new SystemCapturer .SystemOutCapturer ();
46
+ capturer .start ();
47
+ TestHelper .runApp ("reporters" , "-h" );
48
+ String output = capturer .stop ();
49
+
50
+ assertTrue (output .contains ("Usage:" ));
51
+ }
52
+
23
53
@ Test
24
54
void write_help_to_error_out_on_unknown_command () {
25
55
capturer = new SystemCapturer .SystemErrCapturer ();
You can’t perform that action at this time.
0 commit comments