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';
5555```
5656
5757## Usage
58- Currently, utPLSQL-cli supports the following commands:
58+ Currently, utPLSQL-cli supports the following sub- commands:
5959- run
6060- info
6161- 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+ ```
6272
6373#### \< ConnectionURL>
6474
Original file line number Diff line number Diff line change 77import org .utplsql .api .reporter .inspect .ReporterInspector ;
88import org .utplsql .cli .exception .DatabaseConnectionFailed ;
99import picocli .CommandLine .Command ;
10+ import picocli .CommandLine .Option ;
1011import picocli .CommandLine .Parameters ;
1112
1213import javax .sql .DataSource ;
@@ -22,6 +23,9 @@ public class ReportersCommand implements ICommand {
2223 @ Parameters (description = UtplsqlPicocliCommand .COMMANDLINE_PARAM_DESCRIPTION , arity = "1" )
2324 private String connectionString ;
2425
26+ @ Option (names = "-h" , usageHelp = true , description = "display this help and exit" )
27+ boolean help ;
28+
2529 @ Override
2630 public int run () {
2731
Original file line number Diff line number Diff line change 66import org .utplsql .api .db .DefaultDatabaseInformation ;
77import org .utplsql .api .exception .UtPLSQLNotInstalledException ;
88import picocli .CommandLine .Command ;
9+ import picocli .CommandLine .Option ;
910import picocli .CommandLine .Parameters ;
1011
1112import javax .sql .DataSource ;
@@ -18,6 +19,9 @@ public class VersionInfoCommand implements ICommand {
1819 @ Parameters (description = UtplsqlPicocliCommand .COMMANDLINE_PARAM_DESCRIPTION , arity = "0..1" )
1920 private String connectionString ;
2021
22+ @ Option (names = "-h" , usageHelp = true , description = "display this help and exit" )
23+ boolean help ;
24+
2125 public int run () {
2226
2327 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() {
2020 assertTrue (output .contains ("Usage:" ));
2121 }
2222
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+
2353 @ Test
2454 void write_help_to_error_out_on_unknown_command () {
2555 capturer = new SystemCapturer .SystemErrCapturer ();
You can’t perform that action at this time.
0 commit comments