parent
323f2d29ee
commit
a1fce1b06e
|
@ -274,15 +274,6 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ci_info"
|
||||
version = "0.14.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f0e2864372242f01b92c1b882a904f6fb8b57f16e81e148a35b6368b1ea7323"
|
||||
dependencies = [
|
||||
"envmnt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.33.3"
|
||||
|
@ -291,7 +282,7 @@ checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
|
|||
dependencies = [
|
||||
"bitflags 1.2.1",
|
||||
"term_size",
|
||||
"textwrap",
|
||||
"textwrap 0.11.0",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
|
@ -436,41 +427,6 @@ dependencies = [
|
|||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.12.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f2c43f534ea4b0b049015d00269734195e6d3f0f6635cb692251aca6f9f8b3c"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"darling_macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.12.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e91455b86830a1c21799d94524df0845183fa55bafd9aa137b01c7d1065fa36"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote 1.0.9",
|
||||
"strsim",
|
||||
"syn 1.0.77",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.12.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.77",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derivative"
|
||||
version = "2.2.0"
|
||||
|
@ -482,37 +438,6 @@ dependencies = [
|
|||
"syn 1.0.77",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_builder"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d13202debe11181040ae9063d739fa32cfcaaebe2275fe387703460ae2365b30"
|
||||
dependencies = [
|
||||
"derive_builder_macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_builder_core"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "66e616858f6187ed828df7c64a6d71720d83767a7f19740b2d1b6fe6327b36e5"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote 1.0.9",
|
||||
"syn 1.0.77",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_builder_macro"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58a94ace95092c5acb1e97a7e846b310cfbd499652f72297da7493f618a98d73"
|
||||
dependencies = [
|
||||
"derive_builder_core",
|
||||
"syn 1.0.77",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "difflib"
|
||||
version = "0.4.0"
|
||||
|
@ -613,16 +538,6 @@ dependencies = [
|
|||
"syn 1.0.77",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "envmnt"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f96dd862f12fac698dec3932dff0e6fb34bffeb5515ae5932d620cfe076571e"
|
||||
dependencies = [
|
||||
"fsio",
|
||||
"indexmap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "eyre"
|
||||
version = "0.6.5"
|
||||
|
@ -687,15 +602,6 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fsio"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09e87827efaf94c7a44b562ff57de06930712fe21b530c3797cdede26e6377eb"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "funty"
|
||||
version = "1.1.0"
|
||||
|
@ -984,12 +890,6 @@ dependencies = [
|
|||
"tokio-io-timeout",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ident_case"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||
|
||||
[[package]]
|
||||
name = "indenter"
|
||||
version = "0.3.3"
|
||||
|
@ -1050,6 +950,12 @@ dependencies = [
|
|||
"cfg-if 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is_ci"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb"
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.10.1"
|
||||
|
@ -1181,23 +1087,28 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "miette"
|
||||
version = "1.1.0"
|
||||
version = "3.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca9f4fb4bdea8f89558cc2206db47fb93c133f8c6be74185e005da7e5b850f52"
|
||||
checksum = "ec47e61dc212c43f44dcd1f2841ccba79c6ec10da357cab7a7859b5f87bd27a9"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"ci_info",
|
||||
"backtrace",
|
||||
"miette-derive",
|
||||
"once_cell",
|
||||
"owo-colors 2.1.0",
|
||||
"supports-color",
|
||||
"supports-hyperlinks",
|
||||
"supports-unicode",
|
||||
"term_size",
|
||||
"textwrap 0.14.2",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miette-derive"
|
||||
version = "1.1.0"
|
||||
version = "3.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f2d64ffd9ebd80644efb9d444aa436b126a76b7d3fef78708be1752fca81064"
|
||||
checksum = "2c0f0b6f999b9a9f7e86322125583a437cf015054b7aaa9926dff0ff13005b7e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote 1.0.9",
|
||||
|
@ -2022,6 +1933,12 @@ version = "1.7.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
|
||||
|
||||
[[package]]
|
||||
name = "smawk"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043"
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.4.2"
|
||||
|
@ -2038,12 +1955,6 @@ version = "1.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.8.0"
|
||||
|
@ -2060,6 +1971,34 @@ dependencies = [
|
|||
"syn 0.11.11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "supports-color"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4872ced36b91d47bae8a214a683fe54e7078875b399dfa251df346c9b547d1f9"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"is_ci",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "supports-hyperlinks"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "590b34f7c5f01ecc9d78dba4b3f445f31df750a67621cf31626f3b7441ce6406"
|
||||
dependencies = [
|
||||
"atty",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "supports-unicode"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8b945e45b417b125a8ec51f1b7df2f8df7920367700d1f98aedd21e5735f8b2"
|
||||
dependencies = [
|
||||
"atty",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.11.11"
|
||||
|
@ -2154,6 +2093,17 @@ dependencies = [
|
|||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.14.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
|
||||
dependencies = [
|
||||
"smawk",
|
||||
"unicode-linebreak",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.29"
|
||||
|
@ -2461,6 +2411,15 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-linebreak"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a52dcaab0c48d931f7cc8ef826fa51690a08e1ea55117ef26f89864f532383f"
|
||||
dependencies = [
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.8.0"
|
||||
|
@ -2580,7 +2539,6 @@ dependencies = [
|
|||
"clearscreen",
|
||||
"color-eyre",
|
||||
"command-group",
|
||||
"derive_builder",
|
||||
"dunce",
|
||||
"futures",
|
||||
"globset",
|
||||
|
@ -2602,10 +2560,10 @@ version = "1.17.1"
|
|||
dependencies = [
|
||||
"assert_cmd",
|
||||
"clap",
|
||||
"color-eyre",
|
||||
"console-subscriber",
|
||||
"embed-resource",
|
||||
"insta",
|
||||
"miette",
|
||||
"notify-rust",
|
||||
"tokio",
|
||||
"tracing-subscriber",
|
||||
|
|
|
@ -21,7 +21,7 @@ path = "src/main.rs"
|
|||
|
||||
[dependencies]
|
||||
watchexec = { path = "../lib" }
|
||||
color-eyre = "0.5.11"
|
||||
miette = { version = "3.2.0", features = ["fancy"] }
|
||||
console-subscriber = { git = "https://github.com/tokio-rs/console", optional = true }
|
||||
notify-rust = "4.5.2"
|
||||
tokio = { version = "1.10.0", features = ["full"] }
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::{
|
|||
};
|
||||
|
||||
use clap::{crate_version, App, Arg, ArgMatches};
|
||||
use color_eyre::eyre::{Context, Report, Result};
|
||||
use miette::{Context, IntoDiagnostic, Result};
|
||||
|
||||
pub fn get_args() -> Result<ArgMatches<'static>> {
|
||||
let app = App::new("watchexec")
|
||||
|
@ -18,7 +18,7 @@ pub fn get_args() -> Result<ArgMatches<'static>> {
|
|||
.help("Command to execute")
|
||||
.multiple(true)
|
||||
.required(true))
|
||||
.arg(Arg::with_name("extensions") // TODO
|
||||
.arg(Arg::with_name("extensions")
|
||||
.help("Comma-separated list of file extensions to watch (e.g. js,css,html)")
|
||||
.short("e")
|
||||
.long("exts")
|
||||
|
@ -143,12 +143,13 @@ pub fn get_args() -> Result<ArgMatches<'static>> {
|
|||
if let Some(arg_path) = first.strip_prefix('@').map(Path::new) {
|
||||
let arg_file = BufReader::new(
|
||||
File::open(arg_path)
|
||||
.into_diagnostic()
|
||||
.wrap_err_with(|| format!("Failed to open argument file {:?}", arg_path))?,
|
||||
);
|
||||
|
||||
let mut more_args: Vec<OsString> = arg_file
|
||||
.lines()
|
||||
.map(|l| l.map(OsString::from).map_err(Report::from))
|
||||
.map(|l| l.map(OsString::from).into_diagnostic())
|
||||
.collect::<Result<_>>()?;
|
||||
|
||||
more_args.insert(0, raw_args.remove(0));
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::{
|
|||
};
|
||||
|
||||
use clap::ArgMatches;
|
||||
use color_eyre::eyre::{eyre, Result};
|
||||
use miette::{IntoDiagnostic, Result};
|
||||
use watchexec::{
|
||||
action::{Action, Outcome, Signal},
|
||||
command::Shell,
|
||||
|
@ -31,21 +31,21 @@ fn runtime(args: &ArgMatches<'static>) -> Result<(RuntimeConfig, Arc<TaggedFilte
|
|||
|
||||
config.command(
|
||||
args.values_of_lossy("command")
|
||||
.ok_or_else(|| eyre!("(clap) Bug: command is not present"))?
|
||||
.expect("(clap) Bug: command is not present")
|
||||
.iter(),
|
||||
);
|
||||
|
||||
config.pathset(match args.values_of_os("paths") {
|
||||
Some(paths) => paths.map(|os| Path::new(os).to_owned()).collect(),
|
||||
None => vec![current_dir()?],
|
||||
None => vec![current_dir().into_diagnostic()?],
|
||||
});
|
||||
|
||||
config.action_throttle(Duration::from_millis(
|
||||
args.value_of("debounce").unwrap_or("100").parse()?,
|
||||
args.value_of("debounce").unwrap_or("100").parse().into_diagnostic()?,
|
||||
));
|
||||
|
||||
if let Some(interval) = args.value_of("poll") {
|
||||
config.file_watcher(Watcher::Poll(Duration::from_millis(interval.parse()?)));
|
||||
config.file_watcher(Watcher::Poll(Duration::from_millis(interval.parse().into_diagnostic()?)));
|
||||
}
|
||||
|
||||
config.command_shell(if args.is_present("no-shell") {
|
||||
|
@ -81,7 +81,7 @@ fn runtime(args: &ArgMatches<'static>) -> Result<(RuntimeConfig, Arc<TaggedFilte
|
|||
let mut signal = args
|
||||
.value_of("signal")
|
||||
.map(|s| Signal::from_str(s))
|
||||
.transpose()?
|
||||
.transpose().into_diagnostic()?
|
||||
.unwrap_or(Signal::SIGTERM);
|
||||
|
||||
if args.is_present("kill") {
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
use std::env::var;
|
||||
|
||||
use color_eyre::eyre::Result;
|
||||
use watchexec::{event::Event, Watchexec};
|
||||
use miette::{IntoDiagnostic, Result};
|
||||
|
||||
mod args;
|
||||
mod config;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
color_eyre::install()?;
|
||||
|
||||
#[cfg(feature = "dev-console")]
|
||||
console_subscriber::init();
|
||||
|
||||
|
@ -43,7 +40,7 @@ async fn main() -> Result<()> {
|
|||
wx.send_event(Event::default()).await?;
|
||||
}
|
||||
|
||||
wx.main().await??;
|
||||
wx.main().await.into_diagnostic()??;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ clearscreen = "1.0.6"
|
|||
dunce = "1.0.2"
|
||||
futures = "0.3.16"
|
||||
globset = "0.4.8"
|
||||
miette = "1.0.0-beta.1"
|
||||
miette = "3.2.0"
|
||||
nom = "7.0.0"
|
||||
notify = "5.0.0-pre.12"
|
||||
once_cell = "1.8.0"
|
||||
|
|
Loading…
Reference in New Issue