Skip to content

Commit 33f6e02

Browse files
committed
Allow spaces in filepath name by forwarding all arguments
1 parent 0224d84 commit 33f6e02

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

app/src/processing/app/Processing.kt

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,30 +59,23 @@ class LSP: SuspendingCliktCommand("lsp"){
5959
}
6060
}
6161

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+
6366
override fun help(context: Context) = "Legacy processing-java command line interface"
6467

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())
7569

76-
override suspend fun run(){
77-
val cliArgs = args.filter { it != "cli" }
70+
override suspend fun run() {
7871
try {
79-
if(build){
72+
if (arguments.contains("--build")) {
8073
System.setProperty("java.awt.headless", "true")
8174
}
82-
// Indirect invocation since app does not depend on java mode
75+
8376
Class.forName("processing.mode.java.Commander")
8477
.getMethod("main", Array<String>::class.java)
85-
.invoke(null, *arrayOf<Any>(cliArgs.toTypedArray()))
78+
.invoke(null, arguments.toTypedArray())
8679
} catch (e: Exception) {
8780
throw InternalError("Failed to invoke main method", e)
8881
}

0 commit comments

Comments
 (0)