Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
`rad config set` should print error if value was not set
did:key:z6MkgFq6...nBGz opened 10 months ago

Actual behaviour

rad config set suggests that a value was set, although it wasn't. Running e.g.

$ rad config set 'preferredSeeds[0]' "z6MkrLMMsiPWUcNPHcRajuMi9mDfYckSoJyPwwnknocNYPm7@iris.radicle.xyz:8776"
z6MkrLMMsiPWUcNPHcRajuMi9mDfYckSoJyPwwnknocNYPm7@iris.radicle.xyz:8776

results in an unchanged config file:

{
  "publicExplorer": "https://app.radicle.xyz/nodes/$host/$rid$path",
  "preferredSeeds": [],
  "web": {
    "pinned": {
      "repositories": []
    }
  },
...

Expected behaviour

rad config set should print an error if no value was set.

z6MkgFq6...nBGz added crate=radicle-cli 10 months ago
z6MkgFq6...nBGz added good first issue 10 months ago
z6MkireR...3voM commented 10 months ago

rad config set shouldn't even work like that lol! As far as I know, it won't dig into the object. Could you open your file manually and check if you have a key called preferredSeeds[0] now? Hahaha

z6MkgFq6...nBGz commented 10 months ago

Oh my, I didn't realize...I tried this jq-style syntax at some in the past already (independent from the OP on Zulip) because that felt natural to me.

I think it's fine to leave the current behavior then, but maybe add some examples to the rad config --help. WDYT?

z6MkgFq6...nBGz commented 10 months ago

It just came to my mind that we should also print the key, so users will at least see what key they've set.

z6MkireR...3voM commented 10 months ago

Ya, examples would be a great addition. I think printing the new key and value would also be great.

A stretch goal would be to parse a key ensuring that people don't use [] syntax, however, that does mean we restrict the types of keys that could be used – which could be arguably be a bad experience if someone wanted to add new keys of that form.

z6MkgFq6...nBGz removed good first issue 8 months ago
z6MkgFq6...nBGz added type=improvement 8 months ago
jabłko_ziemne commented 8 days ago

Are then custom config keys supported? I ran rad config set dupa aaaa and got confised when rad config didnt show it anywhere, even though rad config get dupa worked fine.

I checked on current master caee776c388ffac2ea55cc9d1e3d7fa108ca6df5