diff options
Diffstat (limited to 'cli/flags.rs')
-rw-r--r-- | cli/flags.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cli/flags.rs b/cli/flags.rs index f018d00b0..e87924491 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -50,6 +50,7 @@ pub enum DenoSubcommand { check: bool, files: Vec<PathBuf>, ignore: Vec<PathBuf>, + ext: String, }, Info { json: bool, @@ -400,8 +401,11 @@ fn fmt_parse(flags: &mut Flags, matches: &clap::ArgMatches) { Some(f) => f.map(PathBuf::from).collect(), None => vec![], }; + let ext = matches.value_of("ext").unwrap().to_string(); + flags.subcommand = DenoSubcommand::Fmt { check: matches.is_present("check"), + ext, files, ignore, } @@ -810,6 +814,14 @@ Ignore formatting a file by adding an ignore comment at the top of the file: .takes_value(false), ) .arg( + Arg::with_name("ext") + .long("ext") + .help("Set standard input (stdin) content type") + .takes_value(true) + .default_value("ts") + .possible_values(&["ts", "tsx", "js", "jsx", "md"]), + ) + .arg( Arg::with_name("ignore") .long("ignore") .takes_value(true) @@ -1991,6 +2003,7 @@ mod tests { PathBuf::from("script_1.ts"), PathBuf::from("script_2.ts") ], + ext: "ts".to_string() }, ..Flags::default() } @@ -2004,6 +2017,7 @@ mod tests { ignore: vec![], check: true, files: vec![], + ext: "ts".to_string(), }, ..Flags::default() } @@ -2017,6 +2031,7 @@ mod tests { ignore: vec![], check: false, files: vec![], + ext: "ts".to_string(), }, ..Flags::default() } @@ -2030,6 +2045,7 @@ mod tests { ignore: vec![], check: false, files: vec![], + ext: "ts".to_string(), }, watch: true, unstable: true, @@ -2053,6 +2069,7 @@ mod tests { ignore: vec![PathBuf::from("bar.js")], check: true, files: vec![PathBuf::from("foo.ts")], + ext: "ts".to_string(), }, watch: true, unstable: true, |