Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mise settings improvements #3301

Closed
hverlin opened this issue Nov 30, 2024 · 3 comments · Fixed by #3307
Closed

mise settings improvements #3301

hverlin opened this issue Nov 30, 2024 · 3 comments · Fixed by #3307

Comments

@hverlin
Copy link
Contributor

hverlin commented Nov 30, 2024

mise settings has been improved in the latest releases and now offers json output. Thank you!

❯ mise settings --json                    
{
  "disable_backends": "[\"java\"]",
  "experimental": true
}

❯ mise settings --toml                    
disable_backends = ["java"]
experimental = true

❯ mise settings                           
Key               Value    Source                    
disable_backends  ["java"] ~/.config/mise/config.toml
experimental      true     ~/.config/mise/config.toml

Would it be possible to make the following changes? (I can create PRs)

{
  "experimental": { "value": true, "source": "~/.config/mise/config.toml" }
}
  • arrays are shown as strings in the json output, but not in the toml output. I believe this might be a bug?

For context, I am trying to display them in https://github.com/hverlin/mise-vscode:
image

I have also noticed that python.default_packages_file does not show in the default output, even it's different from the default value. I might use the default output from mise going forward, but just curious why isn't it shown?

@jdx
Copy link
Owner

jdx commented Nov 30, 2024

arrays are shown as strings in the json output, but not in the toml output. I believe this might be a bug?

looks like escape characters are added to the json output that shouldn't be there. I think in json we should return arrays but in toml it should probably return one string for the array delimited by how the settings get read in. Otherwise you wouldn't be able to take the output from this command and use it as input into another config file.

toml and/or json output could include the source of the settings, like it does for the table output (I have a similar request for mise env --json in #3012)

I considered doing that in the initial version but the output is a lot less friendly IMO. I think we should add this behind a --sources flag for json and toml

@hverlin
Copy link
Contributor Author

hverlin commented Nov 30, 2024

looks like escape characters are added to the json output that shouldn't be there. I think in json we should return arrays but in toml it should probably return one string for the array delimited by how the settings get read in. Otherwise you wouldn't be able to take the output from this command and use it as input into another config file.

So the toml output stays as is. However, I can update the json output to:

{
  "disable_backends": ["java"],
  "experimental": true
}

I agree that the toml with sources might not be so useful. What about adding an extra output format: --json-with-sources for both mise settings and mise env?

mise settings ls --json-with-sources
{
  "disable_backends": { "value": ["java"], "source": "~/.config/mise/config.toml" },
  "experimental": { "value": true, "source": "~/.config/mise/config.toml" }
}

@jdx
Copy link
Owner

jdx commented Nov 30, 2024

I think that's a good idea. Makes it clear it's only for json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants