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 cfg set completions #3908

Open
jdx opened this issue Jan 1, 2025 · 1 comment
Open

mise cfg set completions #3908

jdx opened this issue Jan 1, 2025 · 1 comment

Comments

@jdx
Copy link
Owner

jdx commented Jan 1, 2025

this is going to be tricky. I managed to implement some commands like mise settings --complete that lists completions for settings which works similarly:

$ mise settings --complete
activate_aggressive:Pushes tools' bin-paths to the front of PATH instead of allowing modifications of PATH after activation to take precedence.
all_compile:do not use precompiled binaries for any tool
always_keep_download:should mise keep downloaded files after installation
always_keep_install:should mise keep install files after installation even if the installation fails

Settings are fairly simple though because they're well-defined and we have the SETTINGS_META hash that gives us all the settings with their descriptions. For config, we don't really have a formal definition of what the config looks like, and it's much more complex.

For example, you should get this (ignoring descriptions to keep it simple but the actual solution should have descriptions too):

$ mise cfg --complete
env
tools
settings
...

And in order to dive in further:

$ mise cfg --complete settings.
settings.activate_aggressive
settings.all_compile
...

But this should also work with things like tools.node. and tasks.foo..

Now we do have the json schema, but we don't read that in mise anywhere and I don't think parsing that in a useful way would be very easy at all.

2 other ideas aside from json schema:

  • make mise cfg --complete written completely manually with all the options manually defined
  • create a new file like settings.toml that's used to generate both the json schema and these completions

I like the last idea the best since it would make it easier to stay up-to-date with changes in json schema but I'm not sure how well it would come together.

@jdx jdx added the enhancement label Jan 8, 2025
@jdx
Copy link
Owner Author

jdx commented Jan 8, 2025

Having a well-defined config schema file in toml might be useful for doc generation too. It might be wise to keep json schema separated from this since json schema is quite complex. Maybe we could have a mise-config.toml schema file we just use for doc generation and mise cfg completions but nothing else.

If nothing else that is probably a good way to start. We could begin there and if it makes sense to merge json schema and maybe config parsing we could do that later.

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

No branches or pull requests

1 participant