diff --git a/Cargo.lock b/Cargo.lock index fa08d6993c..599beafcbb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -521,7 +521,7 @@ dependencies = [ "bitflags", "cexpr", "clang-sys", - "itertools 0.10.5", + "itertools 0.13.0", "log", "prettyplease", "proc-macro2", @@ -1618,7 +1618,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -1854,7 +1854,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -3930,7 +3930,7 @@ dependencies = [ "portable-atomic", "portable-atomic-util", "serde_core", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -4778,7 +4778,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -4899,7 +4899,7 @@ version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51e219e79014df21a225b1860a479e2dcd7cbd9130f4defd4bd0e191ea31d67d" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "chrono", "getrandom 0.2.16", "http", @@ -5134,7 +5134,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" dependencies = [ "libc", - "windows-sys 0.45.0", + "windows-sys 0.61.2", ] [[package]] @@ -5801,7 +5801,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -6234,7 +6234,7 @@ dependencies = [ "errno 0.3.14", "libc", "linux-raw-sys", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -7268,7 +7268,7 @@ dependencies = [ "getrandom 0.3.4", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -7956,9 +7956,9 @@ checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" [[package]] name = "usage-lib" -version = "2.9.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78dbd0f6785bae11eaa326ab5eef76722b89ea6983b8e5b089f6f7c4f697bffb" +checksum = "a27ec085c49de45832474c6b760679ac039ffe1a22d7993bd1f96d1879c9e0f3" dependencies = [ "clap", "heck", @@ -8272,7 +8272,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] diff --git a/mise.lock b/mise.lock index dc16a49d5b..dfb7d82cc5 100644 --- a/mise.lock +++ b/mise.lock @@ -79,7 +79,7 @@ version = "0.2.3" backend = "cargo:toml-cli" [[tools."cargo:usage-cli"]] -version = "2.10.0" +version = "2.11.0" backend = "cargo:usage-cli" [[tools.fd]] diff --git a/mise.usage.kdl b/mise.usage.kdl index 932c078468..7c2fda6be9 100644 --- a/mise.usage.kdl +++ b/mise.usage.kdl @@ -1,8 +1,9 @@ -min_usage_version "1.3" +min_usage_version "2.11" name mise bin mise about "The front-end to your dev env" long_about "mise manages dev tools, env vars, and runs tasks. https://github.com/jdx/mise" +default_subcommand run usage "Usage: mise [OPTIONS] [TASK] [COMMAND]" flag "-c --continue-on-error" help="Continue running tasks even if one fails" hide=#true flag "-C --cd" help="Change directory before running command" global=#true { @@ -676,7 +677,7 @@ cmd reshim help="Creates new shims based on bin paths from currently installed t arg "[PLUGIN]" required=#false hide=#true arg "[VERSION]" required=#false hide=#true } -cmd run help="Run task(s)" { +cmd run restart_token=::: help="Run task(s)" { alias r long_help "Run task(s)\n\nThis command will run a task, or multiple tasks in parallel.\nTasks may have dependencies on other tasks or on source files.\nIf source is configured on a task, it will only run if the source\nfiles have changed.\n\nTasks can be defined in mise.toml or as standalone scripts.\nIn mise.toml, tasks take this form:\n\n [tasks.build]\n run = \"npm run build\"\n sources = [\"src/**/*.ts\"]\n outputs = [\"dist/**/*.js\"]\n\nAlternatively, tasks can be defined as standalone scripts.\nThese must be located in `mise-tasks`, `.mise-tasks`, `.mise/tasks`, `mise/tasks` or\n`.config/mise/tasks`.\nThe name of the script will be the name of the tasks.\n\n $ cat .mise/tasks/build< Result<()> { let cli = Cli::command().version(Resettable::Reset); let mut spec: usage::Spec = cli.into(); + + // Enable "naked" task completions: `mise foo` completes like `mise run foo` + spec.default_subcommand = Some("run".to_string()); + let run = spec.cmd.subcommands.get_mut("run").unwrap(); run.args = vec![]; run.mounts.push(usage::SpecMount { run: "mise tasks --usage".to_string(), }); + // Enable completions after ::: separator for multi-task invocations + run.restart_token = Some(":::".to_string()); let tasks = spec.cmd.subcommands.get_mut("tasks").unwrap(); let tasks_run = tasks.subcommands.get_mut("run").unwrap(); tasks_run.mounts.push(usage::SpecMount { run: "mise tasks --usage".to_string(), }); + tasks_run.restart_token = Some(":::".to_string()); - let min_version = r#"min_usage_version "1.3""#; + let min_version = r#"min_usage_version "2.11""#; let extra = include_str!("../assets/mise-extra.usage.kdl").trim(); println!("{min_version}\n{}\n{extra}", spec.to_string().trim()); Ok(()) diff --git a/src/task/task_script_parser.rs b/src/task/task_script_parser.rs index b7f1883e7e..34bed3b7f3 100644 --- a/src/task/task_script_parser.rs +++ b/src/task/task_script_parser.rs @@ -339,6 +339,8 @@ impl TaskScriptParser { long, default, var, + var_min: None, + var_max: None, hide, global, count, @@ -461,6 +463,8 @@ impl TaskScriptParser { long, default, var, + var_min: None, + var_max: None, hide, global, count,