Does anyone know how to properly quote a Rust enum as arg in Powershell?

In bash you can use '{ "North": {} }' if you want to provide the North variant of an enum as CLI arg but that isn't working on Windows in Powershell.

How is your program parsing CLI arguments? What is the error in Powershell?

Hello jofas, thank you for responding to the topic. I thought that “rust enum” and “powershell” were sufficient, so I didn't provide more information.

It is not my program, but an open source program – unfortunately, even the developers have no idea what the Powershell quotation rules are.

The CLI is using Clap's ArgMatches:

The server receives a ByteString (see bytestring crate) and is using Serde for deserialization:

The trace is:

https://github.com/clockworklabs/SpacetimeDB/blob/master/crates/client-api/src/routes/database.rs#L111
https://github.com/clockworklabs/SpacetimeDB/blob/master/crates/core/src/host/module_host.rs#L901
https://github.com/clockworklabs/SpacetimeDB/blob/master/crates/core/src/host/module_host.rs#L860
https://github.com/clockworklabs/SpacetimeDB/blob/master/crates/core/src/host/mod.rs#L42

I'm still not sure what the actual erroneous behaviour is. The argument string looks fine according to the powershell docs.

If you show us the command that works in bash, we can show you the equivalent in powershell, but the snippet you posted is identical in both so there's probably something else going on.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.