From 542ec461c4f970727d5a7dabeaae27689efb88f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E6=96=87?= Date: Tue, 19 Nov 2019 02:19:59 +0800 Subject: [PATCH] feat: add --check for deno fmt (#3369) --- cli/flags.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cli/flags.rs b/cli/flags.rs index 393ca48b60..5a95d39e8c 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -340,6 +340,12 @@ Automatically downloads Prettier dependencies on first run. deno fmt myfile1.ts myfile2.ts", ) + .arg( + Arg::with_name("check") + .long("check") + .help("Check if the source files are formatted.") + .takes_value(false), + ) .arg( Arg::with_name("prettierrc") .long("prettierrc") @@ -992,6 +998,7 @@ pub fn flags_from_vec( } let prettier_flags = [ + ["0", "check"], ["1", "prettierrc"], ["1", "ignore-path"], ["1", "print-width"], @@ -2088,6 +2095,7 @@ mod tests { let (flags, subcommand, argv) = flags_from_vec(svec![ "deno", "fmt", + "--check", "--prettierrc=auto", "--print-width=100", "--tab-width=4", @@ -2119,6 +2127,7 @@ mod tests { PRETTIER_URL, "script.ts", "--write", + "--check", "--config", "auto", "--ignore-path",