Skip to content

Commit

Permalink
Whoops. Fixes #167
Browse files Browse the repository at this point in the history
  • Loading branch information
passcod committed Mar 29, 2021
1 parent c56490d commit 402af30
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Expand Up @@ -30,6 +30,7 @@ clap = "2.33.1"
log = "0.4.8"
stderrlog = "0.4.3"
watchexec = "=1.14.0"
shell-escape = "0.1.5"

[dev-dependencies]
assert_cmd = "1.0.1"
Expand Down
2 changes: 1 addition & 1 deletion src/args.rs
Expand Up @@ -167,7 +167,7 @@ pub fn parse() -> ArgMatches<'static> {
.arg(
Arg::with_name("cmd:trail")
.raw(true)
.help("Full command to run. -x and -s will be ignored!")
.help("Full command to run. -x and -s will be ignored!"),
)
.after_help(footnote.as_str()),
);
Expand Down
7 changes: 6 additions & 1 deletion src/lib.rs
Expand Up @@ -75,7 +75,12 @@ pub fn set_commands(builder: &mut ArgsBuilder, matches: &ArgMatches) {

if matches.is_present("cmd:trail") {
debug!("trailing command is present, ignore all other command options");
commands = vec![value_t!(matches, "cmd:trail", String).unwrap_or_else(|e| e.exit())];
commands = vec![values_t!(matches, "cmd:trail", String)
.unwrap_or_else(|e| e.exit())
.into_iter()
.map(|arg| shell_escape::escape(arg.into()))
.collect::<Vec<_>>()
.join(" ")];
}

// Default to `cargo check`
Expand Down
8 changes: 6 additions & 2 deletions src/main.rs
@@ -1,7 +1,7 @@
//! Watch files in a Cargo project and compile it when they change
#![warn(clippy::all)]

use cargo_watch::{args, change_dir, watch::CwHandler, get_options};
use cargo_watch::{args, change_dir, get_options, watch::CwHandler};
use stderrlog::Timestamp;
use watchexec::{error::Result, run::watch};

Expand All @@ -16,7 +16,11 @@ fn main() -> Result<()> {
stderrlog::new()
.quiet(quiet)
.verbosity(if debug { 3 } else { 1 })
.timestamp(if testing { Timestamp::Off } else { Timestamp::Millisecond })
.timestamp(if testing {
Timestamp::Off
} else {
Timestamp::Millisecond
})
.init()
.unwrap();

Expand Down

0 comments on commit 402af30

Please sign in to comment.