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