From 6a5893a26927e3c0329a510f870d2277387aaf30 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Thu, 16 May 2019 23:11:35 +0900 Subject: fmt: use --write option of prettier/main.ts (#2363) This is step 1 of the plan outlined here: https://github.com/denoland/deno/issues/2090#issuecomment-492897028 --- cli/flags.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cli/flags.rs b/cli/flags.rs index fa632513a..171c05ad0 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -448,6 +448,9 @@ pub fn flags_from_vec( .collect(); argv.extend(files); + // `deno fmt` writes to the files by default + argv.push("--write".to_string()); + DenoSubcommand::Run } ("info", Some(info_match)) => { @@ -726,7 +729,13 @@ mod tests { assert_eq!(subcommand, DenoSubcommand::Run); assert_eq!( argv, - svec!["deno", PRETTIER_URL, "script_1.ts", "script_2.ts"] + svec![ + "deno", + PRETTIER_URL, + "script_1.ts", + "script_2.ts", + "--write" + ] ); } -- cgit v1.2.3