Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Commands:
repl Starts the DW repl.
Example:

dw run -i payload <fullPathToUser.json> "output application/json --- payload
dw run -i payload=<fullPathToUser.json> "output application/json --- payload
filter (item) -> item.age > 17"

Documentation reference:
Expand Down
2 changes: 1 addition & 1 deletion native-cli/src/main/java/org/mule/weave/cli/DWCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void run(String[] args, Console console) {
"(____/\\_/\\_/(__)\\_/\\_/(_/\\_)(____)\\_/\\_/ \\__/ (____)",
footer = "Example:\n" +
"\n" +
" dw run -i payload <fullPathToUser.json> \"output application/json --- payload\n" +
" dw run -i payload=<fullPathToUser.json> \"output application/json --- payload\n" +
"filter (item) -> item.age > 17\"\n" +
"\n" +
" Documentation reference:\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,18 @@ class DataWeaveCLITest extends AnyFreeSpec with Matchers {
maybeError.isEmpty shouldBe false
}

"should run with input file using name=path form" in {
val tmpFile = java.io.File.createTempFile("test-input", ".json")
tmpFile.deleteOnExit()
java.nio.file.Files.writeString(tmpFile.toPath, """{"greeting":"hello"}""")
val stream = new ByteArrayOutputStream()
val console = new TestConsole(System.in, stream)
val dwcli = createCommandLine(console)
val exitCode = dwcli.execute("run", "-i", s"payload=${tmpFile.getAbsolutePath}", "output application/json --- payload.greeting")
exitCode shouldBe 0
Source.fromBytes(stream.toByteArray, "UTF-8").mkString.trim shouldBe "\"hello\""
}

"should run using parameter" in {
val stream = new ByteArrayOutputStream()
val testConsole = new TestConsole(System.in, stream)
Expand Down
Loading