Skip to content

Commit

Permalink
feat: multiple MISE_ENV environments
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Dec 5, 2024
1 parent cc37bf0 commit 7ad74d5
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Shorthand for `mise task run <TASK>`.

Change directory before running command

### `-E --env <ENV>`
### `-E --env... <ENV>`

Set the environment for loading `mise.<ENV>.toml`

Expand Down
4 changes: 2 additions & 2 deletions mise.usage.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ flag "-C --cd" help="Change directory before running command" global=true {
}
flag "-n --dry-run" help="Dry run, don't actually do anything" hide=true global=true
flag "--debug" help="Sets log level to debug" hide=true global=true
flag "-E --env" help="Set the environment for loading `mise.<ENV>.toml`" global=true {
flag "-E --env" help="Set the environment for loading `mise.<ENV>.toml`" var=true global=true {
arg "<ENV>"
}
flag "-f --force" help="Force the operation" hide=true
Expand All @@ -31,7 +31,7 @@ flag "--log-level" hide=true global=true {
}
}
flag "-p --prefix" hide=true
flag "-P --profile" help="Set the profile (environment)" hide=true global=true {
flag "-P --profile" help="Set the profile (environment)" var=true hide=true global=true {
arg "<PROFILE>"
}
flag "-s --shell" hide=true {
Expand Down
2 changes: 1 addition & 1 deletion src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub struct Cli {
#[clap(long, short, hide = true, overrides_with = "interleave")]
pub prefix: bool,
/// Set the profile (environment)
#[clap(short = 'P', long, global = true, hide = true)]
#[clap(short = 'P', long, global = true, hide = true, conflicts_with = "env")]
pub profile: Option<Vec<String>>,
#[clap(long, short, hide = true)]
pub shell: Option<String>,
Expand Down
1 change: 1 addition & 0 deletions src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ fn environment(args: &[String]) -> Vec<String> {
.or_else(|| var("MISE_ENVIRONMENT").ok())
.unwrap_or_default()
.split(',')
.filter(|s| !s.is_empty())
.map(String::from)
.collect()
}
Expand Down
2 changes: 1 addition & 1 deletion xtasks/fig/src/mise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3145,7 +3145,7 @@ const completionSpec: Fig.Spec = {
"--env"
],
"description": "Set the environment for loading `mise.<ENV>.toml`",
"isRepeatable": false,
"isRepeatable": true,
"args": {
"name": "env",
"isOptional": false,
Expand Down

0 comments on commit 7ad74d5

Please sign in to comment.