diff options
Diffstat (limited to 'cli/flags.rs')
-rw-r--r-- | cli/flags.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cli/flags.rs b/cli/flags.rs index efd0a5c63..80eeba217 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -39,6 +39,7 @@ pub enum DenoSubcommand { Fmt { check: bool, files: Vec<String>, + ignore: Vec<String>, }, Help, Info { @@ -101,6 +102,7 @@ pub struct Flags { pub ca_file: Option<String>, pub cached_only: bool, pub config_path: Option<String>, + pub ignore: Vec<String>, pub import_map_path: Option<String>, pub inspect: Option<SocketAddr>, pub inspect_brk: Option<SocketAddr>, @@ -338,13 +340,20 @@ fn types_parse(flags: &mut Flags, matches: &clap::ArgMatches) { } fn fmt_parse(flags: &mut Flags, matches: &clap::ArgMatches) { + // TODO(divy-work): remove `--unstable` in 1.3.0 + unstable_arg_parse(flags, matches); let files = match matches.values_of("files") { Some(f) => f.map(String::from).collect(), None => vec![], }; + let ignore = match matches.values_of("ignore") { + Some(f) => f.map(String::from).collect(), + None => vec![], + }; flags.subcommand = DenoSubcommand::Fmt { check: matches.is_present("check"), files, + ignore, } } @@ -659,6 +668,16 @@ Ignore formatting a file by adding an ignore comment at the top of the file: .takes_value(false), ) .arg( + Arg::with_name("ignore") + .long("ignore") + .requires("unstable") + .takes_value(true) + .use_delimiter(true) + .require_equals(true) + .help("Ignore formatting particular source files. Use with --unstable"), + ) + .arg(unstable_arg()) + .arg( Arg::with_name("files") .takes_value(true) .multiple(true) @@ -1665,6 +1684,7 @@ mod tests { r.unwrap(), Flags { subcommand: DenoSubcommand::Fmt { + ignore: vec![], check: false, files: vec!["script_1.ts".to_string(), "script_2.ts".to_string()] }, @@ -1677,6 +1697,7 @@ mod tests { r.unwrap(), Flags { subcommand: DenoSubcommand::Fmt { + ignore: vec![], check: true, files: vec![], }, @@ -1689,6 +1710,7 @@ mod tests { r.unwrap(), Flags { subcommand: DenoSubcommand::Fmt { + ignore: vec![], check: false, files: vec![], }, |