mise icon indicating copy to clipboard operation
mise copied to clipboard

Consider adding `-l`/`--local` flags and/or syncing command flags

Open rliebz opened this issue 1 year ago • 2 comments

Much like How I use mise from the docs, I've been taking advantage of .mise.local.toml. Ideally, I'd like to manage this by CLI as much as possible, but there are a few rough spots for me in the workflow—

  • I've been typing mise use -e local a lot, generally for projects where the maintainer wouldn't want. This one is pretty fine on its own.
  • I generally check my various tool settings files into git for use across multiple machines, but I personally consider the list of applications and their installed versions to be more a property of the machine's state rather than configuration, if that distinction makes sense. I considered checking in ~/.config/mise/config.toml with settings and using ~/.config/mise/config.local.toml for managing tool versions, but I struggled to make this work through the CLI. The first thing I tried was mise use -g -e local, but it looks like the -e flag overrides both -g and -p (if a directory is specified). It seems like I could do this by CLI with -p ~/.config/mise/config.local.toml, which works (even though it's a bit verbose). For now I haven't been checking my config into VCS at all, which isn't a huge deal, because there's only 2 things I've been setting.
  • For setting env vars, I type mise set -f .mise.local.toml. A little more verbose, again probably okay in isolation, but It takes some getting used to that the config path options for use and env differ.
  • I haven't really had a need for mise settings with any file other than the default global config file, but I was surprised to see (a) that there was no way to do this by CLI, and (b) that = signs were disallowed

The grand sum of those use cases is that I would write to .local.toml files by CLI using 3 different syntaxes of varying verbosity, depending on the command:

  • mise use -e local [email protected]
  • mise use -p ~/.config/mise/config.local.toml [email protected]
  • mise set -f .mise.local.toml foo=val
  • Settings in ~/.config/mise/config.local.toml cannot be changed via CLI

Ideally what I would like to be able to do is this:

Alternatively or additionally, making the syntax consistent between all commands without defining any new flags would go a long way:

rliebz avatar Apr 15 '24 06:04 rliebz

I think a local flag makes sense. Maybe also --env could be used without an argument to leverage MISE_ENV to find the current one though I dislike optional parameters on args

jdx avatar Apr 27 '24 17:04 jdx

Yeah I'm not sure there's a great way to make a flag have an optional argument without requiring = (e.g., --boolean=false vs --boolean), and if --env already exists it's probably too late for that.

You could always add a separate flag like --auto-env, although I'm not sure I'd personally take advantage of an automatic env discovery flag either way.

rliebz avatar May 15 '24 03:05 rliebz