File tree Expand file tree Collapse file tree 3 files changed +34
-2
lines changed
main/java/org/utplsql/cli
test/java/org/utplsql/cli Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change 22
33import com .beust .jcommander .JCommander ;
44import com .beust .jcommander .ParameterException ;
5+ import picocli .CommandLine ;
6+
7+ import java .util .List ;
58
69public class Cli {
710
@@ -50,5 +53,34 @@ static int runWithExitCode( String[] args ) {
5053
5154 return exitCode ;
5255 }
56+ static int runPicocliWithExitCode ( String [] args ) {
57+
58+ LoggerConfiguration .configure (LoggerConfiguration .ConfigLevel .NONE );
59+ LocaleInitializer .initLocale ();
60+
61+ CommandLine commandLine = new CommandLine (UtplsqlPicocliCommand .class );
62+ commandLine .setTrimQuotes (true );
63+
64+ int exitCode = DEFAULT_ERROR_CODE ;
65+
66+ try {
67+
68+ List <CommandLine > parsedLines = commandLine .parse (args );
69+
70+ for ( CommandLine parsedLine : parsedLines ) {
71+ Object command = parsedLine .getCommand ();
72+ if ( command instanceof ICommand ) {
73+ exitCode = ((ICommand )command ).run ();
74+ break ;
75+ }
76+ }
77+ } catch (ParameterException e ) {
78+ e .printStackTrace ();
79+ } catch (Exception e ) {
80+ e .printStackTrace ();
81+ }
82+
83+ return exitCode ;
84+ }
5385
5486}
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ void run_withDbmsOutputEnabled() throws Exception {
7070
7171 int result = TestHelper .runApp ("run" ,
7272 TestHelper .getConnectionString (),
73- "-dbout " ,
73+ "-D " ,
7474 "--failure-exit-code=2" );
7575
7676 assertValidReturnCode (result );
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ static RunAction createRunAction(String... args) throws Exception {
5454 }
5555
5656 static int runApp (String ... args ) {
57- return Cli .runWithExitCode (args );
57+ return Cli .runPicocliWithExitCode (args );
5858 }
5959
6060 static Version getFrameworkVersion () throws SQLException {
You can’t perform that action at this time.
0 commit comments