diff options
Diffstat (limited to 'cli/flags.rs')
-rw-r--r-- | cli/flags.rs | 262 |
1 files changed, 131 insertions, 131 deletions
diff --git a/cli/flags.rs b/cli/flags.rs index 82cd59ca7..b5ed3cddf 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -72,7 +72,7 @@ impl Default for DenoSubcommand { } #[derive(Clone, Debug, PartialEq, Default)] -pub struct DenoFlags { +pub struct Flags { /// Vector of CLI arguments - these are user script arguments, all Deno /// specific flags are removed. pub argv: Vec<String>, @@ -113,7 +113,7 @@ fn join_paths(whitelist: &[PathBuf], d: &str) -> String { .join(d) } -impl DenoFlags { +impl Flags { /// Return list of permission arguments that are equivalent /// to the ones used to create `self`. pub fn to_permission_args(&self) -> Vec<String> { @@ -208,7 +208,7 @@ lazy_static! { /// Main entry point for parsing deno's command line flags. /// Exits the process on error. -pub fn flags_from_vec(args: Vec<String>) -> DenoFlags { +pub fn flags_from_vec(args: Vec<String>) -> Flags { match flags_from_vec_safe(args) { Ok(flags) => flags, Err(err) => err.exit(), @@ -216,12 +216,12 @@ pub fn flags_from_vec(args: Vec<String>) -> DenoFlags { } /// Same as flags_from_vec but does not exit on error. -pub fn flags_from_vec_safe(args: Vec<String>) -> clap::Result<DenoFlags> { +pub fn flags_from_vec_safe(args: Vec<String>) -> clap::Result<Flags> { let args = arg_hacks(args); let app = clap_root(); let matches = app.get_matches_from_safe(args)?; - let mut flags = DenoFlags::default(); + let mut flags = Flags::default(); if matches.is_present("log-level") { flags.log_level = match matches.value_of("log-level").unwrap() { @@ -297,11 +297,11 @@ fn clap_root<'a, 'b>() -> App<'a, 'b> { .after_help(ENV_VARIABLES_HELP) } -fn types_parse(flags: &mut DenoFlags, _matches: &clap::ArgMatches) { +fn types_parse(flags: &mut Flags, _matches: &clap::ArgMatches) { flags.subcommand = DenoSubcommand::Types; } -fn fmt_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { +fn fmt_parse(flags: &mut Flags, matches: &clap::ArgMatches) { let files = match matches.values_of("files") { Some(f) => f.map(String::from).collect(), None => vec![], @@ -312,7 +312,7 @@ fn fmt_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { } } -fn install_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { +fn install_parse(flags: &mut Flags, matches: &clap::ArgMatches) { permission_args_parse(flags, matches); ca_file_arg_parse(flags, matches); @@ -344,7 +344,7 @@ fn install_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { }; } -fn bundle_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { +fn bundle_parse(flags: &mut Flags, matches: &clap::ArgMatches) { ca_file_arg_parse(flags, matches); let source_file = matches.value_of("source_file").unwrap().to_string(); @@ -362,7 +362,7 @@ fn bundle_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { }; } -fn completions_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { +fn completions_parse(flags: &mut Flags, matches: &clap::ArgMatches) { let shell: &str = matches.value_of("shell").unwrap(); let mut buf: Vec<u8> = vec![]; use std::str::FromStr; @@ -377,7 +377,7 @@ fn completions_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { }; } -fn repl_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { +fn repl_parse(flags: &mut Flags, matches: &clap::ArgMatches) { v8_flags_arg_parse(flags, matches); ca_file_arg_parse(flags, matches); flags.subcommand = DenoSubcommand::Repl; @@ -390,7 +390,7 @@ fn repl_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { flags.allow_hrtime = true; } -fn eval_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { +fn eval_parse(flags: &mut Flags, matches: &clap::ArgMatches) { v8_flags_arg_parse(flags, matches); ca_file_arg_parse(flags, matches); flags.allow_net = true; @@ -404,7 +404,7 @@ fn eval_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { flags.subcommand = DenoSubcommand::Eval { code } } -fn info_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { +fn info_parse(flags: &mut Flags, matches: &clap::ArgMatches) { ca_file_arg_parse(flags, matches); flags.subcommand = DenoSubcommand::Info { @@ -412,7 +412,7 @@ fn info_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { }; } -fn fetch_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { +fn fetch_parse(flags: &mut Flags, matches: &clap::ArgMatches) { reload_arg_parse(flags, matches); lock_args_parse(flags, matches); importmap_arg_parse(flags, matches); @@ -427,7 +427,7 @@ fn fetch_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { flags.subcommand = DenoSubcommand::Fetch { files }; } -fn lock_args_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { +fn lock_args_parse(flags: &mut Flags, matches: &clap::ArgMatches) { if matches.is_present("lock") { let lockfile = matches.value_of("lock").unwrap(); flags.lock = Some(lockfile.to_string()); @@ -445,7 +445,7 @@ fn resolve_fs_whitelist(whitelist: &[PathBuf]) -> Vec<PathBuf> { } // Shared between the run and test subcommands. They both take similar options. -fn run_test_args_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { +fn run_test_args_parse(flags: &mut Flags, matches: &clap::ArgMatches) { reload_arg_parse(flags, matches); lock_args_parse(flags, matches); importmap_arg_parse(flags, matches); @@ -477,7 +477,7 @@ fn run_test_args_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { } } -fn run_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { +fn run_parse(flags: &mut Flags, matches: &clap::ArgMatches) { run_test_args_parse(flags, matches); let mut script: Vec<String> = matches @@ -495,7 +495,7 @@ fn run_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { flags.subcommand = DenoSubcommand::Run { script }; } -fn test_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { +fn test_parse(flags: &mut Flags, matches: &clap::ArgMatches) { flags.allow_read = true; run_test_args_parse(flags, matches); @@ -909,7 +909,7 @@ fn config_arg<'a, 'b>() -> Arg<'a, 'b> { .takes_value(true) } -fn config_arg_parse(flags: &mut DenoFlags, matches: &ArgMatches) { +fn config_arg_parse(flags: &mut Flags, matches: &ArgMatches) { flags.config_path = matches.value_of("config").map(ToOwned::to_owned); } @@ -920,7 +920,7 @@ fn ca_file_arg<'a, 'b>() -> Arg<'a, 'b> { .help("Load certificate authority from PEM encoded file") .takes_value(true) } -fn ca_file_arg_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { +fn ca_file_arg_parse(flags: &mut Flags, matches: &clap::ArgMatches) { flags.ca_file = matches.value_of("cert").map(ToOwned::to_owned); } @@ -945,7 +945,7 @@ fn reload_arg<'a, 'b>() -> Arg<'a, 'b> { ) } -fn reload_arg_parse(flags: &mut DenoFlags, matches: &ArgMatches) { +fn reload_arg_parse(flags: &mut Flags, matches: &ArgMatches) { if matches.is_present("reload") { if matches.value_of("reload").is_some() { let cache_bl = matches.values_of("reload").unwrap(); @@ -974,7 +974,7 @@ Examples: https://github.com/WICG/import-maps#the-import-map", .takes_value(true) } -fn importmap_arg_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { +fn importmap_arg_parse(flags: &mut Flags, matches: &clap::ArgMatches) { flags.import_map_path = matches.value_of("importmap").map(ToOwned::to_owned); } @@ -987,7 +987,7 @@ fn v8_flags_arg<'a, 'b>() -> Arg<'a, 'b> { .help("Set V8 command line options. For help: --v8-flags=--help") } -fn v8_flags_arg_parse(flags: &mut DenoFlags, matches: &ArgMatches) { +fn v8_flags_arg_parse(flags: &mut Flags, matches: &ArgMatches) { if let Some(v8_flags) = matches.values_of("v8-flags") { let s: Vec<String> = v8_flags.map(String::from).collect(); flags.v8_flags = Some(s); @@ -1000,13 +1000,13 @@ fn no_remote_arg<'a, 'b>() -> Arg<'a, 'b> { .help("Do not resolve remote modules") } -fn no_remote_arg_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { +fn no_remote_arg_parse(flags: &mut Flags, matches: &clap::ArgMatches) { if matches.is_present("no-remote") { flags.no_remote = true; } } -fn permission_args_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) { +fn permission_args_parse(flags: &mut Flags, matches: &clap::ArgMatches) { if matches.is_present("allow-read") { if matches.value_of("allow-read").is_some() { let read_wl = matches.values_of("allow-read").unwrap(); @@ -1206,12 +1206,12 @@ mod tests { let flags = r.unwrap(); assert_eq!( flags, - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, reload: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1227,13 +1227,13 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { reload: true, subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, allow_write: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1248,12 +1248,12 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, v8_flags: Some(svec!["--help"]), - ..DenoFlags::default() + ..Flags::default() } ); @@ -1265,12 +1265,12 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, v8_flags: Some(svec!["--expose-gc", "--gc-stats=1"]), - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1287,13 +1287,13 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "gist.ts".to_string(), }, argv: svec!["--title", "X"], allow_net: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1303,7 +1303,7 @@ mod tests { let r = flags_from_vec_safe(svec!["deno", "run", "--allow-all", "gist.ts"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "gist.ts".to_string(), }, @@ -1314,7 +1314,7 @@ mod tests { allow_write: true, allow_plugin: true, allow_hrtime: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1325,12 +1325,12 @@ mod tests { flags_from_vec_safe(svec!["deno", "run", "--allow-read", "gist.ts"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "gist.ts".to_string(), }, allow_read: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1341,12 +1341,12 @@ mod tests { flags_from_vec_safe(svec!["deno", "run", "--allow-hrtime", "gist.ts"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "gist.ts".to_string(), }, allow_hrtime: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1354,7 +1354,7 @@ mod tests { #[test] fn double_hyphen() { // notice that flags passed after double dash will not - // be parsed to DenoFlags but instead forwarded to + // be parsed to Flags but instead forwarded to // script args as Deno.args let r = flags_from_vec_safe(svec![ "deno", @@ -1367,13 +1367,13 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, argv: svec!["--", "-D", "--allow-net"], allow_write: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1384,36 +1384,36 @@ mod tests { flags_from_vec_safe(svec!["deno", "fmt", "script_1.ts", "script_2.ts"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Fmt { check: false, files: vec!["script_1.ts".to_string(), "script_2.ts".to_string()] }, - ..DenoFlags::default() + ..Flags::default() } ); let r = flags_from_vec_safe(svec!["deno", "fmt", "--check"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Fmt { check: true, files: vec![], }, - ..DenoFlags::default() + ..Flags::default() } ); let r = flags_from_vec_safe(svec!["deno", "fmt"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Fmt { check: false, files: vec![], }, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1423,9 +1423,9 @@ mod tests { let r = flags_from_vec_safe(svec!["deno", "types"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Types, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1435,11 +1435,11 @@ mod tests { let r = flags_from_vec_safe(svec!["deno", "fetch", "script.ts"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Fetch { files: svec!["script.ts"], }, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1449,20 +1449,20 @@ mod tests { let r = flags_from_vec_safe(svec!["deno", "info", "script.ts"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Info { file: Some("script.ts".to_string()), }, - ..DenoFlags::default() + ..Flags::default() } ); let r = flags_from_vec_safe(svec!["deno", "info"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Info { file: None }, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1478,12 +1478,12 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, config_path: Some("tsconfig.json".to_owned()), - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1494,7 +1494,7 @@ mod tests { flags_from_vec_safe(svec!["deno", "eval", "'console.log(\"hello\")'"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Eval { code: "'console.log(\"hello\")'".to_string(), }, @@ -1505,7 +1505,7 @@ mod tests { allow_write: true, allow_plugin: true, allow_hrtime: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1516,7 +1516,7 @@ mod tests { flags_from_vec_safe(svec!["deno", "eval", "--v8-flags=--help", "42"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Eval { code: "42".to_string(), }, @@ -1528,7 +1528,7 @@ mod tests { allow_write: true, allow_plugin: true, allow_hrtime: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1538,7 +1538,7 @@ mod tests { let r = flags_from_vec_safe(svec!["deno"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Repl, allow_net: true, allow_env: true, @@ -1547,7 +1547,7 @@ mod tests { allow_write: true, allow_plugin: true, allow_hrtime: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1565,13 +1565,13 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { allow_read: false, read_whitelist: vec![current_dir().unwrap(), temp_dir], subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1589,13 +1589,13 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { allow_write: false, write_whitelist: vec![current_dir().unwrap(), temp_dir], subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1610,13 +1610,13 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, allow_net: false, net_whitelist: svec!["127.0.0.1"], - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1626,11 +1626,11 @@ mod tests { let r = flags_from_vec_safe(svec!["deno", "script.ts"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1645,13 +1645,13 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, allow_net: true, allow_read: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1661,12 +1661,12 @@ mod tests { let r = flags_from_vec_safe(svec!["deno", "bundle", "source.ts"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Bundle { source_file: "source.ts".to_string(), out_file: None, }, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1677,13 +1677,13 @@ mod tests { flags_from_vec_safe(svec!["deno", "bundle", "source.ts", "bundle.js"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Bundle { source_file: "source.ts".to_string(), out_file: Some(PathBuf::from("bundle.js")), }, allow_write: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1698,12 +1698,12 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, import_map_path: Some("importmap.json".to_owned()), - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1717,12 +1717,12 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, import_map_path: Some("importmap.json".to_owned()), - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1737,12 +1737,12 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Fetch { files: svec!["script.ts"], }, import_map_path: Some("importmap.json".to_owned()), - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1753,11 +1753,11 @@ mod tests { flags_from_vec_safe(svec!["deno", "fetch", "script.ts", "script_two.ts"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Fetch { files: svec!["script.ts", "script_two.ts"], }, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1768,13 +1768,13 @@ mod tests { flags_from_vec_safe(svec!["deno", "run", "--seed", "250", "script.ts"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, seed: Some(250 as u64), v8_flags: Some(svec!["--random-seed=250"]), - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1791,13 +1791,13 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, seed: Some(250 as u64), v8_flags: Some(svec!["--expose-gc", "--random-seed=250"]), - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1812,7 +1812,7 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Install { dir: None, exe_name: "deno_colors".to_string(), @@ -1820,7 +1820,7 @@ mod tests { args: vec![], force: false, }, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1837,7 +1837,7 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Install { dir: None, exe_name: "file_server".to_string(), @@ -1847,7 +1847,7 @@ mod tests { }, allow_net: true, allow_read: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1869,7 +1869,7 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Install { dir: Some(PathBuf::from("/usr/local/bin")), exe_name: "file_server".to_string(), @@ -1879,7 +1879,7 @@ mod tests { }, allow_net: true, allow_read: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1890,12 +1890,12 @@ mod tests { flags_from_vec_safe(svec!["deno", "--log-level=debug", "script.ts"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, log_level: Some(Level::Debug), - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1917,10 +1917,10 @@ mod tests { flags_from_vec_safe(svec!["deno", "script.ts", "--allow-read", "--allow-net"]); assert_eq!( flags, - DenoFlags { + Flags { allow_net: true, allow_read: true, - ..DenoFlags::default() + ..Flags::default() } ); assert_eq!(subcommand, DenoSubcommand::Run); @@ -1939,11 +1939,11 @@ mod tests { ]); assert_eq!( flags, - DenoFlags { + Flags { allow_net: true, allow_read: true, reload: true, - ..DenoFlags::default() + ..Flags::default() } ); assert_eq!(subcommand, DenoSubcommand::Run); @@ -1951,19 +1951,19 @@ mod tests { let (flags, subcommand, argv) = flags_from_vec_safe(svec!["deno""script.ts", "foo", "bar"]); - assert_eq!(flags, DenoFlags::default()); + assert_eq!(flags, Flags::default()); assert_eq!(subcommand, DenoSubcommand::Run); assert_eq!(argv, svec!["script.ts", "foo", "bar"]); let (flags, subcommand, argv) = flags_from_vec_safe(svec!["deno""script.ts", "-"]); - assert_eq!(flags, DenoFlags::default()); + assert_eq!(flags, Flags::default()); assert_eq!(subcommand, DenoSubcommand::Run); assert_eq!(argv, svec!["script.ts", "-"]); let (flags, subcommand, argv) = flags_from_vec_safe(svec!["deno""script.ts", "-", "foo", "bar"]); - assert_eq!(flags, DenoFlags::default()); + assert_eq!(flags, Flags::default()); assert_eq!(subcommand, DenoSubcommand::Run); assert_eq!(argv, svec!["script.ts", "-", "foo", "bar"]); } @@ -1974,12 +1974,12 @@ mod tests { let r = flags_from_vec_safe(svec!["deno", "--no-remote", "script.ts"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, no_remote: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -1989,12 +1989,12 @@ mod tests { let r = flags_from_vec_safe(svec!["deno", "--cached-only", "script.ts"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, cached_only: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -2008,7 +2008,7 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, @@ -2021,7 +2021,7 @@ mod tests { "127.0.0.1:4545", "localhost:4545" ], - ..DenoFlags::default() + ..Flags::default() } ); } @@ -2036,13 +2036,13 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, lock_write: true, lock: Some("lock.json".to_string()), - ..DenoFlags::default() + ..Flags::default() } ); } @@ -2059,7 +2059,7 @@ mod tests { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Test { fail_fast: false, quiet: false, @@ -2068,7 +2068,7 @@ mod tests { }, allow_read: true, allow_net: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -2085,12 +2085,12 @@ fn run_with_cafile() { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Run { script: "script.ts".to_string(), }, ca_file: Some("example.crt".to_owned()), - ..DenoFlags::default() + ..Flags::default() } ); } @@ -2106,13 +2106,13 @@ fn bundle_with_cafile() { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Bundle { source_file: "source.ts".to_string(), out_file: None, }, ca_file: Some("example.crt".to_owned()), - ..DenoFlags::default() + ..Flags::default() } ); } @@ -2128,7 +2128,7 @@ fn eval_with_cafile() { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Eval { code: "console.log('hello world')".to_string(), }, @@ -2140,7 +2140,7 @@ fn eval_with_cafile() { allow_write: true, allow_plugin: true, allow_hrtime: true, - ..DenoFlags::default() + ..Flags::default() } ); } @@ -2157,12 +2157,12 @@ fn fetch_with_cafile() { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Fetch { files: svec!["script.ts", "script_two.ts"], }, ca_file: Some("example.crt".to_owned()), - ..DenoFlags::default() + ..Flags::default() } ); } @@ -2178,12 +2178,12 @@ fn info_with_cafile() { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Info { file: Some("https://example.com".to_string()), }, ca_file: Some("example.crt".to_owned()), - ..DenoFlags::default() + ..Flags::default() } ); } @@ -2200,7 +2200,7 @@ fn install_with_cafile() { ]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Install { dir: None, exe_name: "deno_colors".to_string(), @@ -2209,7 +2209,7 @@ fn install_with_cafile() { force: false, }, ca_file: Some("example.crt".to_owned()), - ..DenoFlags::default() + ..Flags::default() } ); } @@ -2219,7 +2219,7 @@ fn repl_with_cafile() { let r = flags_from_vec_safe(svec!["deno", "repl", "--cert", "example.crt"]); assert_eq!( r.unwrap(), - DenoFlags { + Flags { subcommand: DenoSubcommand::Repl {}, ca_file: Some("example.crt".to_owned()), allow_read: true, @@ -2229,7 +2229,7 @@ fn repl_with_cafile() { allow_run: true, allow_plugin: true, allow_hrtime: true, - ..DenoFlags::default() + ..Flags::default() } ); } |