Repository: candlecorp/wick (language: rust)

Issue:
`--values` arg on `wick invoke` doesn't work as expected
**Describe the bug**
Passing `--values` to `wick invoke` should only emit the success values as output, but its not hooked up anymore.

**To Reproduce**
Run `wick invoke common/redact:0.0.1 --op-with='{"patterns":["world"]}' regex --values -- --input="Hello, world"`

**Expected behavior**
wick should output `Hello, XXXXX`

**Actual behavior**
wick outputs `{"payload":{"value":"Hello, XXXXX"},"port":"output"}`

**Environment:**
 - OS: mac
 - Architecture: m1
 - Build Version: 0.17


`--values` arg on `wick invoke` doesn't work as expected
**Describe the bug**
Passing `--values` to `wick invoke` should only emit the success values as output, but its not hooked up anymore.

**To Reproduce**
Run `wick invoke common/redact:0.0.1 --op-with='{"patterns":["world"]}' regex --values -- --input="Hello, world"`

**Expected behavior**
wick should output `Hello, XXXXX`

**Actual behavior**
wick outputs `{"payload":{"value":"Hello, XXXXX"},"port":"output"}`

**Environment:**
 - OS: mac
 - Architecture: m1
 - Build Version: 0.17




Discussion / hints:

Fix patch:
diff --git a/src/utils.rs b/src/utils.rs
index eaa08ecf..c3ff8586 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -172,7 +172,7 @@ pub(crate) async fn print_stream_json(
   mut stream: PacketStream,
 
   filter: &[String],
-  _terse: bool,
+  terse: bool,
   raw: bool,
 ) -> Result<()> {
   if !filter.is_empty() {
@@ -181,15 +181,34 @@ pub(crate) async fn print_stream_json(
   while let Some(packet) = stream.next().await {
     match packet {
       Ok(packet) => {
-        if (packet.is_done()) && !raw {
+        if (packet.is_signal()) && !raw {
           continue;
         }
         if !filter.is_empty() && !filter.iter().any(|name| name == packet.port()) {
           tracing::debug!(port = %packet.port(), "cli:output:filtering");
           continue;
         }
-        let json = packet.to_json();
-        println!("{}", json);
+        if terse {
+          match packet.payload {
+            wick_packet::PacketPayload::Ok(_) => {
+              let value = packet.decode_value()?;
+              match value {
+                Value::String(s) => {
+                  println!("{}", s);
+                }
+                _ => {
+                  println!("{}", value);
+                }
+              }
+            }
+            wick_packet::PacketPayload::Err(e) => {
+              anyhow::bail!("{}", e);
+            }
+          }
+        } else {
+          let json = packet.to_json();
+          println!("{}", json);
+        }
       }
       Err(e) => {
         error!(error = %e, "cli:output:error");


Test patch: