Compare commits

...

7 Commits

Author SHA1 Message Date
Félix Saparelli f8298c5a7e
8.5.1 2024-01-04 20:46:20 +13:00
Félix Saparelli e0f94688c5
Correctly allow no-args special support 2024-01-04 20:46:12 +13:00
Félix Saparelli 881e116437
8.5.0 2024-01-04 19:52:08 +13:00
Félix Saparelli 09cf7246d5
Revert rsign2 2024-01-04 19:51:30 +13:00
Félix Saparelli 8982002659
Update release tooling 2024-01-04 19:51:30 +13:00
Félix Saparelli 5c5b4acad8
Update deps 2024-01-04 19:51:30 +13:00
Félix Saparelli 8fe960f52c
Add select support for '-x'-less cargo commands (#297) 2024-01-04 19:10:27 +13:00
9 changed files with 530 additions and 312 deletions

View File

@ -23,7 +23,7 @@ jobs:
- macos
toolchain:
- stable
- 1.67.1
- 1.70.0
name: Test on ${{ matrix.platform }} with ${{ matrix.toolchain }}
runs-on: "${{ matrix.platform }}-latest"

View File

@ -86,10 +86,10 @@ jobs:
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('.github/workflows/release.yml') }}
- name: Install cargo-deb
if: startsWith(matrix.name, 'linux-')
run: which cargo-deb || cargo install cargo-deb --version 1.30.0 --locked
run: which cargo-deb || cargo install cargo-deb --version 1.44.1 --locked
- name: Install cargo-generate-rpm
if: startsWith(matrix.name, 'linux-')
run: which cargo-generate-rpm || cargo install cargo-generate-rpm --version 0.5.0 --locked
run: which cargo-generate-rpm || cargo install cargo-generate-rpm --version 0.13.0 --locked
- uses: actions-rs/toolchain@v1
with:
@ -200,7 +200,7 @@ jobs:
- name: Install rsign2
run: cargo install rsign2 --version 0.5.7
- name: Install b3sum
run: cargo install b3sum --version 0.3.7
run: cargo install b3sum --version 1.5.0
- uses: actions/download-artifact@v3
with:

View File

@ -3,8 +3,8 @@ message: |
If you use this software, please cite it using these metadata.
title: "Cargo Watch: a project-watching companion tool for Cargo"
version: "8.4.1"
date-released: 2023-08-30
version: "8.5.1"
date-released: 2024-01-04
repository-code: https://github.com/watchexec/cargo-watch
license: CC0-1.0

760
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
[package]
name = "cargo-watch"
version = "8.4.1"
version = "8.5.1"
authors = ["Félix Saparelli <felix@passcod.name>"]
license = "CC0-1.0"
@ -14,7 +14,7 @@ repository = "https://github.com/watchexec/cargo-watch"
readme = "README.md"
edition = "2021"
rust-version = "1.67.1"
rust-version = "1.70.0"
exclude = ["/.github"]
[[bin]]

View File

@ -15,7 +15,7 @@ If you've used [nodemon], [guard], or [entr], it will probably feel familiar.
[guard]: http://guardgem.org/
- In the public domain / licensed with CC0.
- Minimum Supported Rust Version: 1.67.1.
- Minimum Supported Rust Version: 1.70.0.
- Only the last five stable versions are supported.
- MSRV increases beyond that range at publish time will not incur major version bumps.

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "CARGO\-WATCH" "1" "February 2023" "" ""
.TH "CARGO\-WATCH" "1" "January 2024" "" ""
.
.SH "NAME"
\fBcargo\-watch\fR \- watches over your Cargo project\'s source

View File

@ -237,19 +237,35 @@ pub fn parse() -> ArgMatches<'static> {
.short("L")
.takes_value(true)
)
.arg(
Arg::with_name("cmd:trail")
.raw(true)
.help("Full command to run. -x and -s will be ignored!"),
)
.arg(
Arg::with_name("skip-local-deps")
.help("Don't try to find local dependencies of the current crate and watch their working directories. Only watch the current directory.")
.long("skip-local-deps")
)
.subcommand(special_cargo_subc("bench"))
.subcommand(special_cargo_subc("build"))
.subcommand(special_cargo_subc("check"))
.subcommand(special_cargo_subc("clippy"))
.subcommand(special_cargo_subc("test"))
.arg(
Arg::with_name("cmd:trail")
.raw(true)
.help("Full command to run. -x and -s will be ignored!"),
)
.after_help(footnote.as_str()),
);
fn special_cargo_subc(name: &str) -> App {
SubCommand::with_name(name)
.setting(AppSettings::AllowLeadingHyphen)
.setting(AppSettings::DisableHelpFlags)
.setting(AppSettings::DisableHelpSubcommand)
.setting(AppSettings::DisableVersion)
.setting(AppSettings::Hidden)
.setting(AppSettings::TrailingVarArg)
.arg(Arg::with_name("args").multiple(true))
}
// Allow invocation of cargo-watch with both `cargo-watch watch ARGS`
// (as invoked by cargo) and `cargo-watch ARGS`.
let mut args: Vec<String> = env::args().collect();

View File

@ -6,7 +6,7 @@ use std::{
};
use cargo_metadata::{MetadataCommand, Node, Package, PackageId};
use clap::{value_t, values_t, ArgMatches};
use clap::{value_t, values_t, ArgMatches, ErrorKind};
use log::{debug, warn};
use watchexec::{
config::{Config, ConfigBuilder},
@ -21,9 +21,39 @@ pub fn set_commands(builder: &mut ConfigBuilder, matches: &ArgMatches) {
// and before the remaining arguments
let features = value_t!(matches, "features", String).ok();
let subcommand_cargo = {
let (name, args) = matches.subcommand();
if name.is_empty() {
None
} else if let Some(args) = args {
let mut cargo_cmd = vec![name.to_string()];
cargo_cmd.extend(values_t!(args, "args", String).unwrap_or_else(|e| {
if e.kind == ErrorKind::ArgumentNotFound {
Vec::new()
} else {
e.exit()
}
}));
Some(cargo_cmd.join(" "))
} else {
// shouldn't happen per clap2, but just in case:
Some(name.to_string())
}
};
// Cargo commands are in front of the rest
if matches.is_present("cmd:cargo") {
for cargo in values_t!(matches, "cmd:cargo", String).unwrap_or_else(|e| e.exit()) {
if matches.is_present("cmd:cargo") || subcommand_cargo.is_some() {
let normal_cargos = values_t!(matches, "cmd:cargo", String).unwrap_or_else(|e| {
if e.kind == ErrorKind::ArgumentNotFound {
Vec::new()
} else {
e.exit()
}
});
for cargo in normal_cargos
.into_iter()
.chain(subcommand_cargo.into_iter())
{
let mut cmd: String = "cargo ".into();
let cargo = cargo.trim_start();
// features are supported for the following