Skip to content

Commit

Permalink
Merge branch 'main' into task-config-dir
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx authored Nov 27, 2024
2 parents bb90d12 + b3cb34f commit ff42b6f
Show file tree
Hide file tree
Showing 31 changed files with 335 additions and 269 deletions.
2 changes: 1 addition & 1 deletion docs/cli/generate/github-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ when you push changes to your repository.

## Flags

### `-n --name <NAME>`
### `--name <NAME>`

the name of the workflow to generate

Expand Down
24 changes: 20 additions & 4 deletions docs/cli/index.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,39 @@
# `mise`

**Usage**: `mise [FLAGS] <SUBCOMMAND>`
**Usage**: `mise [FLAGS] [TASK] <SUBCOMMAND>`

- **Usage**: `mise [FLAGS] <SUBCOMMAND>`
- **Usage**: `mise [FLAGS] [TASK] <SUBCOMMAND>`

## Arguments

### `[TASK]`

Task to run.

Shorthand for `mise task run <TASK>`.

## Global Flags

### `-C --cd <DIR>`

Change directory before running command

### `-P --profile <PROFILE>`
### `-E --env <ENV>`

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

### `-j --jobs <JOBS>`

How many jobs to run in parallel [default: 4]

### `-q --quiet`

Suppress non-error messages

### `--raw`

Read/write directly to stdin/stdout/stderr instead of by line

### `-v --verbose...`

Show extra output (use -vv for even more)
Expand Down
6 changes: 6 additions & 0 deletions docs/tasks/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ task3 = "echo task3"
run = "echo task4"
```

## Running tasks

Tasks can be run with `mise run <TASK>` or `mise <TASK>`—if the name doesn't conflict with a mise command.
Because mise may later add a command with a conflicting name, it's recommended to use `mise run <TASK>` in
scripts and documentation.

## Vars

Vars are variables that can be shared between tasks like environment variables but they are not
Expand Down
8 changes: 8 additions & 0 deletions e2e/env/test_source
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

cat <<'EOF' >.mise.toml
[env]
_.file = 'not_present'
EOF

assert "mise env" # does not error
2 changes: 1 addition & 1 deletion e2e/plugins/core/test_node
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mise use nodejs@20.1.0
mise ls
assert "mise x -- node --version" "v20.1.0"
assert_contains "mise ls-remote nodejs" "20.1.0"
assert_contains "mise node nodebuild --version" "node-build "
assert_contains "mise node -- nodebuild --version" "node-build "
mise use --rm node

# MISE_LEGACY_VERSION_FILE env var
Expand Down
2 changes: 1 addition & 1 deletion e2e/tasks/test_task_run_toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ assert "mise run test-with-args foo --force --user=user" "foo true user"
assert "mise run test-with-defaults" "arg1 user1"
assert "mise run test-with-defaults arg2 --user=user2" "arg2 user2"
assert "mise run test-with-template" "2"
assert "mise run int" "DEBUG=0"
assert "mise int" "DEBUG=0"

cat <<EOF >mise.windows.toml
tasks.configtask = "echo configtask:windows"
Expand Down
21 changes: 18 additions & 3 deletions man/man1/mise.1
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
.SH NAME
mise \- The front\-end to your dev env
.SH SYNOPSIS
\fBmise\fR [\fB\-C\fR|\fB\-\-cd\fR] [\fB\-P\fR|\fB\-\-profile\fR] [\fB\-q\fR|\fB\-\-quiet\fR] [\fB\-v\fR|\fB\-\-verbose\fR]... [\fB\-y\fR|\fB\-\-yes\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] <\fIsubcommands\fR>
\fBmise\fR [\fB\-C\fR|\fB\-\-cd\fR] [\fB\-E\fR|\fB\-\-env\fR] [\fB\-j\fR|\fB\-\-jobs\fR] [\fB\-q\fR|\fB\-\-quiet\fR] [\fB\-\-raw\fR] [\fB\-v\fR|\fB\-\-verbose\fR]... [\fB\-y\fR|\fB\-\-yes\fR] [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] [\fITASK\fR] [\fITASK_ARGS\fR] [\fIsubcommands\fR]
.SH DESCRIPTION
.PP
mise is a tool for managing runtime versions. https://github.com/jdx/mise
.PP
It\*(Aqs a replacement for tools like nvm, nodenv, rbenv, rvm, chruby, pyenv, etc.
Expand All @@ -19,12 +20,21 @@ https://asdf\-vm.com/
\fB\-C\fR, \fB\-\-cd\fR=\fIDIR\fR
Change directory before running command
.TP
\fB\-P\fR, \fB\-\-profile\fR=\fIPROFILE\fR
Set the profile (environment)
\fB\-E\fR, \fB\-\-env\fR=\fIENV\fR
Set the environment for loading `mise.<ENV>.toml`
.TP
\fB\-j\fR, \fB\-\-jobs\fR=\fIJOBS\fR
How many jobs to run in parallel [default: 4]
.RS
May also be specified with the \fBMISE_JOBS\fR environment variable.
.RE
.TP
\fB\-q\fR, \fB\-\-quiet\fR
Suppress non\-error messages
.TP
\fB\-\-raw\fR
Read/write directly to stdin/stdout/stderr instead of by line
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Show extra output (use \-vv for even more)
.TP
Expand All @@ -36,6 +46,11 @@ Print help (see a summary with \*(Aq\-h\*(Aq)
.TP
\fB\-V\fR, \fB\-\-version\fR
Print version
.TP
[\fITASK\fR]
Task to run.

Shorthand for `mise task run <TASK>`.
.SH SUBCOMMANDS
.TP
mise\-activate(1)
Expand Down
35 changes: 29 additions & 6 deletions mise.usage.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,54 @@ min_usage_version "1.3"
name "mise"
bin "mise"
about "The front-end to your dev env"
long_about r"mise is a tool for managing runtime versions. https://github.com/jdx/mise
long_about r"
mise is a tool for managing runtime versions. https://github.com/jdx/mise

It's a replacement for tools like nvm, nodenv, rbenv, rvm, chruby, pyenv, etc.
that works for any language. It's also great for managing linters/tools like
jq and shellcheck.

It is inspired by asdf and uses asdf's plugin ecosystem under the hood:
https://asdf-vm.com/"
usage "Usage: mise [OPTIONS] <COMMAND>"
usage "Usage: mise [OPTIONS] [TASK] [COMMAND]"
flag "-C --cd" help="Change directory before running command" global=true {
arg "<DIR>"
}
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 "--log-level" help="Set the log output verbosity" hide=true global=true {
flag "-E --env" help="Set the environment for loading `mise.<ENV>.toml`" global=true {
arg "<ENV>"
}
flag "-f --force" help="Force the operation" hide=true
flag "-i --interleave" help="Set the log output verbosity" hide=true
flag "-j --jobs" help="How many jobs to run in parallel [default: 4]" global=true {
arg "<JOBS>"
}
flag "--log-level" hide=true global=true {
arg "<LEVEL>" {
choices "error" "warn" "info" "debug" "trace"
choices "trace" "debug" "info" "warning" "error"
}
}
flag "-P --profile" help="Set the profile (environment)" global=true {
flag "-p --prefix" hide=true
flag "-P --profile" help="Set the profile (environment)" hide=true global=true {
arg "<PROFILE>"
}
flag "-t --tool" help="Tool(s) to run in addition to what is in mise.toml files e.g.: node@20 python@3.10" var=true hide=true {
arg "<TOOL@VERSION>"
}
flag "-q --quiet" help="Suppress non-error messages" global=true
flag "--raw" help="Read/write directly to stdin/stdout/stderr instead of by line" global=true
flag "--timings" help="Shows elapsed time after each task completes" hide=true {
long_help "Shows elapsed time after each task completes\n\nDefault to always show with `MISE_TASK_TIMINGS=1`"
}
flag "--no-timings" help="Hides elapsed time after each task completes" hide=true {
long_help "Hides elapsed time after each task completes\n\nDefault to always hide with `MISE_TASK_TIMINGS=0`"
}
flag "--trace" help="Sets log level to trace" hide=true global=true
flag "-v --verbose" help="Show extra output (use -vv for even more)" var=true global=true count=true
flag "-y --yes" help="Answer yes to all confirmation prompts" global=true
arg "[TASK]" help="Task to run" help_long="Task to run.\n\nShorthand for `mise task run <TASK>`."
arg "[TASK_ARGS]..." help="Task arguments" var=true hide=true
cmd "activate" help="Initializes mise in the current shell session" {
long_help r#"Initializes mise in the current shell session

Expand Down Expand Up @@ -407,7 +430,7 @@ when you push changes to your repository."
$ git commit -m "feat: add new feature"
$ git push # runs `mise run ci` on GitHub
"#
flag "-n --name" help="the name of the workflow to generate" {
flag "--name" help="the name of the workflow to generate" {
arg "<NAME>"
}
flag "-t --task" help="The task to run when the workflow is triggered" {
Expand Down
4 changes: 4 additions & 0 deletions schema/mise.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@
"type": "string"
}
},
"env": {
"description": "Env to use for mise.<MISE_ENV>.toml files.",
"type": "string"
},
"env_file": {
"description": "Path to a file containing environment variables.",
"type": "string"
Expand Down
7 changes: 7 additions & 0 deletions settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ default = []
parse_env = "list_by_comma"
description = "Tools defined in mise.toml that should be ignored"

[env]
env = "MISE_ENV"
type = "String"
description = "Env to use for mise.<MISE_ENV>.toml files."
optional = true

[env_file]
env = "MISE_ENV_FILE"
type = "Path"
Expand Down Expand Up @@ -512,6 +518,7 @@ env = "MISE_PROFILE"
type = "String"
description = "Profile to use for mise.${MISE_PROFILE}.toml files."
optional = true
hide = true

[python.compile]
env = "MISE_PYTHON_COMPILE"
Expand Down
4 changes: 4 additions & 0 deletions src/aqua/aqua_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,21 @@ impl AquaRegistry {
let path = self.path.join("pkgs").join(&path_id).join("registry.yaml");
let registry: RegistryYaml = if !self.repo_exists {
if let Some(registry) = AQUA_STANDARD_REGISTRY_FILES.get(id) {
trace!("reading baked-in aqua-registry for {id}");
serde_yaml::from_str(registry)?
} else if !path.exists() || file::modified_duration(&path)? > DAILY {
trace!("downloading aqua-registry for {id} to {path:?}");
let url: Url =
format!("https://mise-versions.jdx.dev/aqua-registry/{path_id}/registry.yaml")
.parse()?;
http::HTTP_FETCH.download_file(url, &path, None)?;
serde_yaml::from_reader(file::open(&path)?)?
} else {
trace!("reading cached aqua-registry for {id} from {path:?}");
serde_yaml::from_reader(file::open(&path)?)?
}
} else {
trace!("reading aqua-registry for {id} from repo at {path:?}");
serde_yaml::from_reader(file::open(&path)?)?
};
let mut pkg = registry
Expand Down
23 changes: 0 additions & 23 deletions src/cli/args/cd_arg.rs

This file was deleted.

2 changes: 2 additions & 0 deletions src/cli/args/profile_arg.rs → src/cli/args/env_arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use once_cell::sync::Lazy;
pub struct ProfileArg;

pub static PROFILE_ARG: Lazy<Arg> = Lazy::new(ProfileArg::arg);
pub static ENV_ARG: Lazy<Arg> =
Lazy::new(|| clap::arg!(-E --env "Set the environment for loading mise.<ENV>.toml files."));

impl ProfileArg {
fn arg() -> Arg {
Expand Down
47 changes: 0 additions & 47 deletions src/cli/args/log_level_arg.rs

This file was deleted.

14 changes: 2 additions & 12 deletions src/cli/args/mod.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
pub use backend_arg::BackendArg;
pub use cd_arg::CD_ARG;
pub use env_arg::{ENV_ARG, PROFILE_ARG};
pub use env_var_arg::EnvVarArg;
pub use log_level_arg::{DEBUG_ARG, LOG_LEVEL_ARG, TRACE_ARG};
pub use profile_arg::PROFILE_ARG;
pub use quiet_arg::QUIET_ARG;
pub use tool_arg::{ToolArg, ToolVersionType};
pub use verbose_arg::VERBOSE_ARG;
pub use yes_arg::YES_ARG;

mod backend_arg;
mod cd_arg;
mod env_arg;
mod env_var_arg;
mod log_level_arg;
mod profile_arg;
mod quiet_arg;
mod tool_arg;
mod verbose_arg;
mod yes_arg;
19 changes: 0 additions & 19 deletions src/cli/args/quiet_arg.rs

This file was deleted.

Loading

0 comments on commit ff42b6f

Please sign in to comment.