common-fate / granted

The easiest way to access your cloud.
https://granted.dev
MIT License
955 stars 90 forks source link

Handle nested parameters in granted settings set command #690

Closed meyerjrr closed 1 week ago

meyerjrr commented 1 week ago

What changed?

The granted settings set command will now handle nested parameters. For example Backend.Keychain. Dot notation is used for setting a nested value.

eg. granted settings set --setting Keyring.Backend --value File

Nested attributes will also show up in the list when running granted settings set without any flags:

❯ granted settings set
? Select the configuration to change  [Use arrows to move, type to filter]
> DefaultBrowser
  CustomBrowserPath
  CustomSSOBrowserPath
  Keyring.Backend
  Ordering
  ExportCredentialSuffix
  ExportCredsToAWS

Why?

Previously there was no way to set these nested programatically and the ~/.granted/config file would need to be manually edited.

How did you test it?

dgranted settings set and setting the value of Keyring.Backend to a new value

dgranted settings set --setting=Keyring.Backend --value=File

❯ dgranted settings set --setting=Keyring.Backend --value=File
[i] Updating the value of Keyring.Backend to File
[✔] Config updated successfully

Potential risks

Is patch release candidate?

Link to relevant docs PRs

JoshuaWilkes commented 1 week ago

In testing I found that the settings feature doesn't allow you to configure settings that don't already have a value. Specificly if the go type in a pointer, it won;t show up in the list. See this screenshot of the Keychain field not being available because it is not set in the current config

image

I added a test case to show this not working