@@ -59,30 +59,23 @@ class LSP: SuspendingCliktCommand("lsp"){
59
59
}
60
60
}
61
61
62
- class LegacyCLI (val args : Array <String >): SuspendingCliktCommand( " cli" ){
62
+
63
+ class LegacyCLI (val args : Array <String >): SuspendingCliktCommand(" cli" ) {
64
+ override val treatUnknownOptionsAsArgs = true
65
+
63
66
override fun help (context : Context ) = " Legacy processing-java command line interface"
64
67
65
- val help by option(" --help" ).flag()
66
- val build by option(" --build" ).flag()
67
- val run by option(" --run" ).flag()
68
- val present by option(" --present" ).flag()
69
- val sketch: String? by option(" --sketch" )
70
- val force by option(" --force" ).flag()
71
- val output: String? by option(" --output" )
72
- val export by option(" --export" ).flag()
73
- val noJava by option(" --no-java" ).flag()
74
- val variant: String? by option(" --variant" )
68
+ val arguments by argument().multiple(default = emptyList())
75
69
76
- override suspend fun run (){
77
- val cliArgs = args.filter { it != " cli" }
70
+ override suspend fun run () {
78
71
try {
79
- if ( build) {
72
+ if (arguments.contains( " -- build" )) {
80
73
System .setProperty(" java.awt.headless" , " true" )
81
74
}
82
- // Indirect invocation since app does not depend on java mode
75
+
83
76
Class .forName(" processing.mode.java.Commander" )
84
77
.getMethod(" main" , Array <String >::class .java)
85
- .invoke(null , * arrayOf< Any >(cliArgs .toTypedArray() ))
78
+ .invoke(null , arguments .toTypedArray())
86
79
} catch (e: Exception ) {
87
80
throw InternalError (" Failed to invoke main method" , e)
88
81
}
0 commit comments