GetStream / stream-cli

Configure & manage Stream applications from the command line. 🚀
https://yarnpkg.com/en/package/getstream-cli
BSD 3-Clause "New" or "Revised" License
85 stars 19 forks source link

unable to add custom data fields when creating a channel #40

Closed mlaibow closed 2 years ago

mlaibow commented 4 years ago

I always get a parsing error on trying to add a JSON string as custom data fields.

For example: stream chat:channel:create -c=qsfm-general -d='{"vtag":"qsfm"}' -t=pxtype -n=#general

I have tried every format for the json string that i can think of.

Can you provide an example of a functional --data argument to chat:channel:create?

tbarbugli commented 4 years ago

Did you try escaping the double quotes? -d "{\"vtag\": \"qsfm\"}" If that does not work please include the full error here

mlaibow commented 4 years ago

It was in fact the escaping of the quotes. I have been using multiple computers with a variety of shells, and although i thought i tried the correct escape characters for each shell, it looks like i did not. So for anyone else trying to do this, the single quote with double quote does not work on any shell. The backslash escape \" works as above on bash and zsh. For windows commands prompt it is a double double quotes: -d="{""vtag"":""abstr""}"

But I could not get it to work for Windows Powershell using `, \, or "".

Thanks!

peterdeme commented 2 years ago

@mlaibow we rewrote the tool to Go and released it as 1.0.0.

Just opened a PR for this feature and we'll release it as 1.1.0

https://github.com/GetStream/stream-cli/pull/109

peterdeme commented 2 years ago

Released https://github.com/GetStream/stream-cli/releases/tag/v1.1.0