summaryrefslogtreecommitdiff
path: root/cli/flags.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/flags.rs')
-rw-r--r--cli/flags.rs651
1 files changed, 349 insertions, 302 deletions
diff --git a/cli/flags.rs b/cli/flags.rs
index 03167adc6..8bfcbb380 100644
--- a/cli/flags.rs
+++ b/cli/flags.rs
@@ -33,99 +33,144 @@ lazy_static::lazy_static! {
}
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+pub struct BundleFlags {
+ pub source_file: String,
+ pub out_file: Option<PathBuf>,
+}
+
+#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+pub struct CacheFlags {
+ pub files: Vec<String>,
+}
+
+#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+pub struct CompileFlags {
+ pub source_file: String,
+ pub output: Option<PathBuf>,
+ pub args: Vec<String>,
+ pub target: Option<String>,
+}
+
+#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+pub struct CompletionsFlags {
+ pub buf: Box<[u8]>,
+}
+
+#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+pub struct CoverageFlags {
+ pub files: Vec<PathBuf>,
+ pub ignore: Vec<PathBuf>,
+ pub include: Vec<String>,
+ pub exclude: Vec<String>,
+ pub lcov: bool,
+}
+
+#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+pub struct DocFlags {
+ pub private: bool,
+ pub json: bool,
+ pub source_file: Option<String>,
+ pub filter: Option<String>,
+}
+
+#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+pub struct EvalFlags {
+ pub print: bool,
+ pub code: String,
+ pub ext: String,
+}
+
+#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+pub struct FmtFlags {
+ pub check: bool,
+ pub files: Vec<PathBuf>,
+ pub ignore: Vec<PathBuf>,
+ pub ext: String,
+}
+
+#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+pub struct InfoFlags {
+ pub json: bool,
+ pub file: Option<String>,
+}
+
+#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+pub struct InstallFlags {
+ pub module_url: String,
+ pub args: Vec<String>,
+ pub name: Option<String>,
+ pub root: Option<PathBuf>,
+ pub force: bool,
+}
+
+#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+pub struct LintFlags {
+ pub files: Vec<PathBuf>,
+ pub ignore: Vec<PathBuf>,
+ pub rules: bool,
+ pub rules_tags: Vec<String>,
+ pub rules_include: Vec<String>,
+ pub rules_exclude: Vec<String>,
+ pub json: bool,
+}
+
+#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+pub struct ReplFlags {
+ pub eval: Option<String>,
+}
+
+#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+pub struct RunFlags {
+ pub script: String,
+}
+
+#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+pub struct TestFlags {
+ pub ignore: Vec<PathBuf>,
+ pub doc: bool,
+ pub no_run: bool,
+ pub fail_fast: Option<NonZeroUsize>,
+ pub allow_none: bool,
+ pub include: Option<Vec<String>>,
+ pub filter: Option<String>,
+ pub shuffle: Option<u64>,
+ pub concurrent_jobs: NonZeroUsize,
+}
+
+#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
+pub struct UpgradeFlags {
+ pub dry_run: bool,
+ pub force: bool,
+ pub canary: bool,
+ pub version: Option<String>,
+ pub output: Option<PathBuf>,
+ pub ca_file: Option<String>,
+}
+
+#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub enum DenoSubcommand {
- Bundle {
- source_file: String,
- out_file: Option<PathBuf>,
- },
- Cache {
- files: Vec<String>,
- },
- Compile {
- source_file: String,
- output: Option<PathBuf>,
- args: Vec<String>,
- target: Option<String>,
- },
- Completions {
- buf: Box<[u8]>,
- },
- Coverage {
- files: Vec<PathBuf>,
- ignore: Vec<PathBuf>,
- include: Vec<String>,
- exclude: Vec<String>,
- lcov: bool,
- },
- Doc {
- private: bool,
- json: bool,
- source_file: Option<String>,
- filter: Option<String>,
- },
- Eval {
- print: bool,
- code: String,
- ext: String,
- },
- Fmt {
- check: bool,
- files: Vec<PathBuf>,
- ignore: Vec<PathBuf>,
- ext: String,
- },
- Info {
- json: bool,
- file: Option<String>,
- },
- Install {
- module_url: String,
- args: Vec<String>,
- name: Option<String>,
- root: Option<PathBuf>,
- force: bool,
- },
+ Bundle(BundleFlags),
+ Cache(CacheFlags),
+ Compile(CompileFlags),
+ Completions(CompletionsFlags),
+ Coverage(CoverageFlags),
+ Doc(DocFlags),
+ Eval(EvalFlags),
+ Fmt(FmtFlags),
+ Info(InfoFlags),
+ Install(InstallFlags),
Lsp,
- Lint {
- files: Vec<PathBuf>,
- ignore: Vec<PathBuf>,
- rules: bool,
- rules_tags: Vec<String>,
- rules_include: Vec<String>,
- rules_exclude: Vec<String>,
- json: bool,
- },
- Repl {
- eval: Option<String>,
- },
- Run {
- script: String,
- },
- Test {
- ignore: Vec<PathBuf>,
- doc: bool,
- no_run: bool,
- fail_fast: Option<NonZeroUsize>,
- allow_none: bool,
- include: Option<Vec<String>>,
- filter: Option<String>,
- shuffle: Option<u64>,
- concurrent_jobs: NonZeroUsize,
- },
+ Lint(LintFlags),
+ Repl(ReplFlags),
+ Run(RunFlags),
+ Test(TestFlags),
Types,
- Upgrade {
- dry_run: bool,
- force: bool,
- canary: bool,
- version: Option<String>,
- output: Option<PathBuf>,
- ca_file: Option<String>,
- },
+ Upgrade(UpgradeFlags),
}
impl Default for DenoSubcommand {
fn default() -> DenoSubcommand {
- DenoSubcommand::Repl { eval: None }
+ DenoSubcommand::Repl(ReplFlags { eval: None })
}
}
@@ -1560,10 +1605,10 @@ fn bundle_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
flags.watch = matches.is_present("watch");
- flags.subcommand = DenoSubcommand::Bundle {
+ flags.subcommand = DenoSubcommand::Bundle(BundleFlags {
source_file,
out_file,
- };
+ });
}
fn cache_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
@@ -1573,7 +1618,7 @@ fn cache_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
.unwrap()
.map(String::from)
.collect();
- flags.subcommand = DenoSubcommand::Cache { files };
+ flags.subcommand = DenoSubcommand::Cache(CacheFlags { files });
}
fn compile_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
@@ -1590,12 +1635,12 @@ fn compile_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
let output = matches.value_of("output").map(PathBuf::from);
let target = matches.value_of("target").map(String::from);
- flags.subcommand = DenoSubcommand::Compile {
+ flags.subcommand = DenoSubcommand::Compile(CompileFlags {
source_file,
output,
args,
target,
- };
+ });
}
fn completions_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
@@ -1607,9 +1652,9 @@ fn completions_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
&mut buf,
);
- flags.subcommand = DenoSubcommand::Completions {
+ flags.subcommand = DenoSubcommand::Completions(CompletionsFlags {
buf: buf.into_boxed_slice(),
- };
+ });
}
fn coverage_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
@@ -1630,13 +1675,13 @@ fn coverage_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
None => vec![],
};
let lcov = matches.is_present("lcov");
- flags.subcommand = DenoSubcommand::Coverage {
+ flags.subcommand = DenoSubcommand::Coverage(CoverageFlags {
files,
ignore,
include,
exclude,
lcov,
- };
+ });
}
fn doc_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
@@ -1647,12 +1692,12 @@ fn doc_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
let private = matches.is_present("private");
let json = matches.is_present("json");
let filter = matches.value_of("filter").map(String::from);
- flags.subcommand = DenoSubcommand::Doc {
+ flags.subcommand = DenoSubcommand::Doc(DocFlags {
source_file,
json,
filter,
private,
- };
+ });
}
fn eval_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
@@ -1684,7 +1729,7 @@ fn eval_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
for v in code_args {
flags.argv.push(v);
}
- flags.subcommand = DenoSubcommand::Eval { print, code, ext };
+ flags.subcommand = DenoSubcommand::Eval(EvalFlags { print, code, ext });
}
fn fmt_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
@@ -1699,12 +1744,12 @@ fn fmt_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
};
let ext = matches.value_of("ext").unwrap().to_string();
- flags.subcommand = DenoSubcommand::Fmt {
+ flags.subcommand = DenoSubcommand::Fmt(FmtFlags {
check: matches.is_present("check"),
ext,
files,
ignore,
- }
+ });
}
fn info_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
@@ -1713,10 +1758,10 @@ fn info_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
location_arg_parse(flags, matches);
ca_file_arg_parse(flags, matches);
let json = matches.is_present("json");
- flags.subcommand = DenoSubcommand::Info {
+ flags.subcommand = DenoSubcommand::Info(InfoFlags {
file: matches.value_of("file").map(|f| f.to_string()),
json,
- };
+ });
}
fn install_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
@@ -1740,13 +1785,13 @@ fn install_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
let module_url = cmd[0].to_string();
let args = cmd[1..].to_vec();
- flags.subcommand = DenoSubcommand::Install {
+ flags.subcommand = DenoSubcommand::Install(InstallFlags {
name,
module_url,
args,
root,
force,
- };
+ });
}
fn lsp_parse(flags: &mut Flags, _matches: &clap::ArgMatches) {
@@ -1777,7 +1822,7 @@ fn lint_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
None => vec![],
};
let json = matches.is_present("json");
- flags.subcommand = DenoSubcommand::Lint {
+ flags.subcommand = DenoSubcommand::Lint(LintFlags {
files,
rules,
rules_tags,
@@ -1785,15 +1830,15 @@ fn lint_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
rules_exclude,
ignore,
json,
- };
+ });
}
fn repl_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
runtime_args_parse(flags, matches, false, true);
flags.repl = true;
- flags.subcommand = DenoSubcommand::Repl {
+ flags.subcommand = DenoSubcommand::Repl(ReplFlags {
eval: matches.value_of("eval").map(ToOwned::to_owned),
- };
+ });
flags.allow_net = Some(vec![]);
flags.allow_env = Some(vec![]);
flags.allow_run = Some(vec![]);
@@ -1819,7 +1864,7 @@ fn run_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
}
flags.watch = matches.is_present("watch");
- flags.subcommand = DenoSubcommand::Run { script };
+ flags.subcommand = DenoSubcommand::Run(RunFlags { script });
}
fn test_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
@@ -1893,7 +1938,7 @@ fn test_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
flags.coverage_dir = matches.value_of("coverage").map(String::from);
flags.watch = matches.is_present("watch");
- flags.subcommand = DenoSubcommand::Test {
+ flags.subcommand = DenoSubcommand::Test(TestFlags {
no_run,
doc,
fail_fast,
@@ -1903,7 +1948,7 @@ fn test_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
shuffle,
allow_none,
concurrent_jobs,
- };
+ });
}
fn types_parse(flags: &mut Flags, _matches: &clap::ArgMatches) {
@@ -1924,14 +1969,14 @@ fn upgrade_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
None
};
let ca_file = matches.value_of("cert").map(|s| s.to_string());
- flags.subcommand = DenoSubcommand::Upgrade {
+ flags.subcommand = DenoSubcommand::Upgrade(UpgradeFlags {
dry_run,
force,
canary,
version,
output,
ca_file,
- };
+ });
}
fn compile_args_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
@@ -2183,9 +2228,9 @@ mod tests {
assert_eq!(
flags,
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
unstable: true,
log_level: Some(Level::Error),
..Flags::default()
@@ -2204,14 +2249,14 @@ mod tests {
assert_eq!(
flags,
Flags {
- subcommand: DenoSubcommand::Upgrade {
+ subcommand: DenoSubcommand::Upgrade(UpgradeFlags {
force: true,
dry_run: true,
canary: false,
version: None,
output: None,
ca_file: None,
- },
+ }),
..Flags::default()
}
);
@@ -2232,9 +2277,9 @@ mod tests {
assert_eq!(
flags,
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
reload: true,
..Flags::default()
}
@@ -2248,9 +2293,9 @@ mod tests {
assert_eq!(
flags,
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
watch: true,
..Flags::default()
}
@@ -2265,9 +2310,9 @@ mod tests {
r.unwrap(),
Flags {
reload: true,
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
allow_write: Some(vec![]),
..Flags::default()
}
@@ -2280,9 +2325,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "_".to_string(),
- },
+ }),
v8_flags: svec!["--help"],
..Flags::default()
}
@@ -2297,9 +2342,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
v8_flags: svec!["--expose-gc", "--gc-stats=1"],
..Flags::default()
}
@@ -2319,9 +2364,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "gist.ts".to_string(),
- },
+ }),
argv: svec!["--title", "X"],
allow_net: Some(vec![]),
..Flags::default()
@@ -2335,9 +2380,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "gist.ts".to_string(),
- },
+ }),
allow_net: Some(vec![]),
allow_env: Some(vec![]),
allow_run: Some(vec![]),
@@ -2356,9 +2401,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "gist.ts".to_string(),
- },
+ }),
allow_read: Some(vec![]),
..Flags::default()
}
@@ -2371,9 +2416,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "gist.ts".to_string(),
- },
+ }),
allow_hrtime: true,
..Flags::default()
}
@@ -2397,9 +2442,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
argv: svec!["--", "-D", "--allow-net"],
allow_write: Some(vec![]),
..Flags::default()
@@ -2413,7 +2458,7 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Fmt {
+ subcommand: DenoSubcommand::Fmt(FmtFlags {
ignore: vec![],
check: false,
files: vec![
@@ -2421,7 +2466,7 @@ mod tests {
PathBuf::from("script_2.ts")
],
ext: "ts".to_string()
- },
+ }),
..Flags::default()
}
);
@@ -2430,12 +2475,12 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Fmt {
+ subcommand: DenoSubcommand::Fmt(FmtFlags {
ignore: vec![],
check: true,
files: vec![],
ext: "ts".to_string(),
- },
+ }),
..Flags::default()
}
);
@@ -2444,12 +2489,12 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Fmt {
+ subcommand: DenoSubcommand::Fmt(FmtFlags {
ignore: vec![],
check: false,
files: vec![],
ext: "ts".to_string(),
- },
+ }),
..Flags::default()
}
);
@@ -2458,12 +2503,12 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Fmt {
+ subcommand: DenoSubcommand::Fmt(FmtFlags {
ignore: vec![],
check: false,
files: vec![],
ext: "ts".to_string(),
- },
+ }),
watch: true,
..Flags::default()
}
@@ -2480,12 +2525,12 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Fmt {
+ subcommand: DenoSubcommand::Fmt(FmtFlags {
ignore: vec![PathBuf::from("bar.js")],
check: true,
files: vec![PathBuf::from("foo.ts")],
ext: "ts".to_string(),
- },
+ }),
watch: true,
..Flags::default()
}
@@ -2498,7 +2543,7 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Lint {
+ subcommand: DenoSubcommand::Lint(LintFlags {
files: vec![
PathBuf::from("script_1.ts"),
PathBuf::from("script_2.ts")
@@ -2509,7 +2554,7 @@ mod tests {
rules_exclude: vec![],
json: false,
ignore: vec![],
- },
+ }),
..Flags::default()
}
);
@@ -2519,7 +2564,7 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Lint {
+ subcommand: DenoSubcommand::Lint(LintFlags {
files: vec![],
rules: false,
rules_tags: vec![],
@@ -2530,7 +2575,7 @@ mod tests {
PathBuf::from("script_1.ts"),
PathBuf::from("script_2.ts")
],
- },
+ }),
..Flags::default()
}
);
@@ -2539,7 +2584,7 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Lint {
+ subcommand: DenoSubcommand::Lint(LintFlags {
files: vec![],
rules: true,
rules_tags: vec![],
@@ -2547,7 +2592,7 @@ mod tests {
rules_exclude: vec![],
json: false,
ignore: vec![],
- },
+ }),
..Flags::default()
}
);
@@ -2562,7 +2607,7 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Lint {
+ subcommand: DenoSubcommand::Lint(LintFlags {
files: vec![],
rules: false,
rules_tags: svec![""],
@@ -2570,7 +2615,7 @@ mod tests {
rules_exclude: svec!["no-const-assign"],
json: false,
ignore: vec![],
- },
+ }),
..Flags::default()
}
);
@@ -2579,7 +2624,7 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Lint {
+ subcommand: DenoSubcommand::Lint(LintFlags {
files: vec![PathBuf::from("script_1.ts")],
rules: false,
rules_tags: vec![],
@@ -2587,7 +2632,7 @@ mod tests {
rules_exclude: vec![],
json: true,
ignore: vec![],
- },
+ }),
..Flags::default()
}
);
@@ -2603,7 +2648,7 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Lint {
+ subcommand: DenoSubcommand::Lint(LintFlags {
files: vec![PathBuf::from("script_1.ts")],
rules: false,
rules_tags: vec![],
@@ -2611,7 +2656,7 @@ mod tests {
rules_exclude: vec![],
json: true,
ignore: vec![],
- },
+ }),
config_path: Some("Deno.jsonc".to_string()),
..Flags::default()
}
@@ -2636,9 +2681,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Cache {
+ subcommand: DenoSubcommand::Cache(CacheFlags {
files: svec!["script.ts"],
- },
+ }),
..Flags::default()
}
);
@@ -2650,10 +2695,10 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Info {
+ subcommand: DenoSubcommand::Info(InfoFlags {
json: false,
file: Some("script.ts".to_string()),
- },
+ }),
..Flags::default()
}
);
@@ -2662,10 +2707,10 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Info {
+ subcommand: DenoSubcommand::Info(InfoFlags {
json: false,
file: Some("script.ts".to_string()),
- },
+ }),
reload: true,
..Flags::default()
}
@@ -2675,10 +2720,10 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Info {
+ subcommand: DenoSubcommand::Info(InfoFlags {
json: true,
file: Some("script.ts".to_string()),
- },
+ }),
..Flags::default()
}
);
@@ -2687,10 +2732,10 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Info {
+ subcommand: DenoSubcommand::Info(InfoFlags {
json: false,
file: None
- },
+ }),
..Flags::default()
}
);
@@ -2699,10 +2744,10 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Info {
+ subcommand: DenoSubcommand::Info(InfoFlags {
json: true,
file: None
- },
+ }),
..Flags::default()
}
);
@@ -2715,9 +2760,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
config_path: Some("tsconfig.json".to_owned()),
..Flags::default()
}
@@ -2730,11 +2775,11 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Eval {
+ subcommand: DenoSubcommand::Eval(EvalFlags {
print: false,
code: "'console.log(\"hello\")'".to_string(),
ext: "js".to_string(),
- },
+ }),
allow_net: Some(vec![]),
allow_env: Some(vec![]),
allow_run: Some(vec![]),
@@ -2753,11 +2798,11 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Eval {
+ subcommand: DenoSubcommand::Eval(EvalFlags {
print: true,
code: "1+2".to_string(),
ext: "js".to_string(),
- },
+ }),
allow_net: Some(vec![]),
allow_env: Some(vec![]),
allow_run: Some(vec![]),
@@ -2777,11 +2822,11 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Eval {
+ subcommand: DenoSubcommand::Eval(EvalFlags {
print: false,
code: "'console.log(\"hello\")'".to_string(),
ext: "ts".to_string(),
- },
+ }),
allow_net: Some(vec![]),
allow_env: Some(vec![]),
allow_run: Some(vec![]),
@@ -2801,11 +2846,11 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Eval {
+ subcommand: DenoSubcommand::Eval(EvalFlags {
print: false,
code: "42".to_string(),
ext: "js".to_string(),
- },
+ }),
import_map_path: Some("import_map.json".to_string()),
no_remote: true,
config_path: Some("tsconfig.json".to_string()),
@@ -2843,11 +2888,11 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Eval {
+ subcommand: DenoSubcommand::Eval(EvalFlags {
print: false,
code: "console.log(Deno.args)".to_string(),
ext: "js".to_string(),
- },
+ }),
argv: svec!["arg1", "arg2"],
allow_net: Some(vec![]),
allow_env: Some(vec![]),
@@ -2868,7 +2913,7 @@ mod tests {
r.unwrap(),
Flags {
repl: true,
- subcommand: DenoSubcommand::Repl { eval: None },
+ subcommand: DenoSubcommand::Repl(ReplFlags { eval: None }),
allow_net: Some(vec![]),
unsafely_ignore_certificate_errors: None,
allow_env: Some(vec![]),
@@ -2890,7 +2935,7 @@ mod tests {
r.unwrap(),
Flags {
repl: true,
- subcommand: DenoSubcommand::Repl { eval: None },
+ subcommand: DenoSubcommand::Repl(ReplFlags { eval: None }),
import_map_path: Some("import_map.json".to_string()),
no_remote: true,
config_path: Some("tsconfig.json".to_string()),
@@ -2924,9 +2969,9 @@ mod tests {
r.unwrap(),
Flags {
repl: true,
- subcommand: DenoSubcommand::Repl {
+ subcommand: DenoSubcommand::Repl(ReplFlags {
eval: Some("console.log('hello');".to_string()),
- },
+ }),
allow_net: Some(vec![]),
allow_env: Some(vec![]),
allow_run: Some(vec![]),
@@ -2954,9 +2999,9 @@ mod tests {
r.unwrap(),
Flags {
allow_read: Some(vec![PathBuf::from("."), temp_dir]),
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
..Flags::default()
}
);
@@ -2977,9 +3022,9 @@ mod tests {
r.unwrap(),
Flags {
allow_write: Some(vec![PathBuf::from("."), temp_dir]),
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
..Flags::default()
}
);
@@ -2996,9 +3041,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
allow_net: Some(svec!["127.0.0.1"]),
..Flags::default()
}
@@ -3012,9 +3057,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
allow_env: Some(svec!["HOME"]),
..Flags::default()
}
@@ -3032,9 +3077,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
allow_env: Some(svec!["HOME", "PATH"]),
..Flags::default()
}
@@ -3060,10 +3105,10 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Bundle {
+ subcommand: DenoSubcommand::Bundle(BundleFlags {
source_file: "source.ts".to_string(),
out_file: None,
- },
+ }),
..Flags::default()
}
);
@@ -3083,10 +3128,10 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Bundle {
+ subcommand: DenoSubcommand::Bundle(BundleFlags {
source_file: "source.ts".to_string(),
out_file: Some(PathBuf::from("bundle.js")),
- },
+ }),
allow_write: Some(vec![]),
no_remote: true,
config_path: Some("tsconfig.json".to_owned()),
@@ -3101,10 +3146,10 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Bundle {
+ subcommand: DenoSubcommand::Bundle(BundleFlags {
source_file: "source.ts".to_string(),
out_file: Some(PathBuf::from("bundle.js")),
- },
+ }),
allow_write: Some(vec![]),
..Flags::default()
}
@@ -3123,10 +3168,10 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Bundle {
+ subcommand: DenoSubcommand::Bundle(BundleFlags {
source_file: "source.ts".to_string(),
out_file: None,
- },
+ }),
lock_write: true,
lock: Some(PathBuf::from("lock.json")),
..Flags::default()
@@ -3141,10 +3186,10 @@ mod tests {
r.unwrap(),
Flags {
reload: true,
- subcommand: DenoSubcommand::Bundle {
+ subcommand: DenoSubcommand::Bundle(BundleFlags {
source_file: "source.ts".to_string(),
out_file: None,
- },
+ }),
..Flags::default()
}
);
@@ -3157,10 +3202,10 @@ mod tests {
assert_eq!(
r,
Flags {
- subcommand: DenoSubcommand::Bundle {
+ subcommand: DenoSubcommand::Bundle(BundleFlags {
source_file: "script.ts".to_string(),
out_file: None,
- },
+ }),
no_check: true,
..Flags::default()
}
@@ -3173,10 +3218,10 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Bundle {
+ subcommand: DenoSubcommand::Bundle(BundleFlags {
source_file: "source.ts".to_string(),
out_file: None,
- },
+ }),
watch: true,
..Flags::default()
}
@@ -3194,9 +3239,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
import_map_path: Some("import_map.json".to_owned()),
..Flags::default()
}
@@ -3214,10 +3259,10 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Info {
+ subcommand: DenoSubcommand::Info(InfoFlags {
file: Some("script.ts".to_string()),
json: false,
- },
+ }),
import_map_path: Some("import_map.json".to_owned()),
..Flags::default()
}
@@ -3235,9 +3280,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Cache {
+ subcommand: DenoSubcommand::Cache(CacheFlags {
files: svec!["script.ts"],
- },
+ }),
import_map_path: Some("import_map.json".to_owned()),
..Flags::default()
}
@@ -3255,12 +3300,12 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Doc {
+ subcommand: DenoSubcommand::Doc(DocFlags {
source_file: Some("script.ts".to_owned()),
private: false,
json: false,
filter: None,
- },
+ }),
import_map_path: Some("import_map.json".to_owned()),
..Flags::default()
}
@@ -3274,9 +3319,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Cache {
+ subcommand: DenoSubcommand::Cache(CacheFlags {
files: svec!["script.ts", "script_two.ts"],
- },
+ }),
..Flags::default()
}
);
@@ -3288,9 +3333,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
seed: Some(250_u64),
v8_flags: svec!["--random-seed=250"],
..Flags::default()
@@ -3311,9 +3356,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
seed: Some(250_u64),
v8_flags: svec!["--expose-gc", "--random-seed=250"],
..Flags::default()
@@ -3331,13 +3376,13 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Install {
+ subcommand: DenoSubcommand::Install(InstallFlags {
name: None,
module_url: "https://deno.land/std/examples/colors.ts".to_string(),
args: vec![],
root: None,
force: false,
- },
+ }),
..Flags::default()
}
);
@@ -3350,13 +3395,13 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Install {
+ subcommand: DenoSubcommand::Install(InstallFlags {
name: Some("file_server".to_string()),
module_url: "https://deno.land/std/http/file_server.ts".to_string(),
args: svec!["foo", "bar"],
root: Some(PathBuf::from("/foo")),
force: true,
- },
+ }),
import_map_path: Some("import_map.json".to_string()),
no_remote: true,
config_path: Some("tsconfig.json".to_string()),
@@ -3384,9 +3429,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
log_level: Some(Level::Debug),
..Flags::default()
}
@@ -3399,9 +3444,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
log_level: Some(Level::Error),
..Flags::default()
}
@@ -3413,7 +3458,9 @@ mod tests {
let r = flags_from_vec(svec!["deno", "completions", "zsh"]).unwrap();
match r.subcommand {
- DenoSubcommand::Completions { buf } => assert!(!buf.is_empty()),
+ DenoSubcommand::Completions(CompletionsFlags { buf }) => {
+ assert!(!buf.is_empty())
+ }
_ => unreachable!(),
}
}
@@ -3430,9 +3477,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
argv: svec!["--allow-read", "--allow-net"],
..Flags::default()
}
@@ -3453,9 +3500,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
location: Some(Url::parse("https://foo/").unwrap()),
allow_read: Some(vec![]),
argv: svec!["--allow-net", "-r", "--help", "--foo", "bar"],
@@ -3467,9 +3514,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
argv: svec!["foo", "bar"],
..Flags::default()
}
@@ -3478,9 +3525,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
argv: svec!["-"],
..Flags::default()
}
@@ -3491,9 +3538,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
argv: svec!["-", "foo", "bar"],
..Flags::default()
}
@@ -3506,9 +3553,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
no_check: true,
..Flags::default()
}
@@ -3526,9 +3573,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
unsafely_ignore_certificate_errors: Some(vec![]),
..Flags::default()
}
@@ -3546,9 +3593,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
unsafely_ignore_certificate_errors: Some(svec![
"deno.land",
"localhost",
@@ -3568,9 +3615,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
no_remote: true,
..Flags::default()
}
@@ -3583,9 +3630,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
cached_only: true,
..Flags::default()
}
@@ -3603,9 +3650,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
allow_net: Some(svec![
"deno.land",
"0.0.0.0:8000",
@@ -3631,9 +3678,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
allow_net: Some(svec![
"deno.land",
"deno.land:80",
@@ -3663,9 +3710,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
lock_write: true,
lock: Some(PathBuf::from("lock.json")),
..Flags::default()
@@ -3680,7 +3727,7 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Test {
+ subcommand: DenoSubcommand::Test(TestFlags {
no_run: true,
doc: false,
fail_fast: None,
@@ -3690,7 +3737,7 @@ mod tests {
ignore: vec![],
shuffle: None,
concurrent_jobs: NonZeroUsize::new(1).unwrap(),
- },
+ }),
unstable: true,
coverage_dir: Some("cov".to_string()),
location: Some(Url::parse("https://foo/").unwrap()),
@@ -3713,9 +3760,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
ca_file: Some("example.crt".to_owned()),
..Flags::default()
}
@@ -3733,9 +3780,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "script.ts".to_string(),
- },
+ }),
enable_testing_features: true,
..Flags::default()
}
@@ -3748,7 +3795,7 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Test {
+ subcommand: DenoSubcommand::Test(TestFlags {
no_run: false,
doc: false,
fail_fast: None,
@@ -3758,7 +3805,7 @@ mod tests {
include: None,
ignore: vec![],
concurrent_jobs: NonZeroUsize::new(4).unwrap(),
- },
+ }),
..Flags::default()
}
);
@@ -3773,7 +3820,7 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Test {
+ subcommand: DenoSubcommand::Test(TestFlags {
no_run: false,
doc: false,
fail_fast: Some(NonZeroUsize::new(3).unwrap()),
@@ -3783,7 +3830,7 @@ mod tests {
include: None,
ignore: vec![],
concurrent_jobs: NonZeroUsize::new(1).unwrap(),
- },
+ }),
..Flags::default()
}
);
@@ -3802,7 +3849,7 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Test {
+ subcommand: DenoSubcommand::Test(TestFlags {
no_run: false,
doc: false,
fail_fast: None,
@@ -3812,7 +3859,7 @@ mod tests {
include: None,
ignore: vec![],
concurrent_jobs: NonZeroUsize::new(1).unwrap(),
- },
+ }),
enable_testing_features: true,
..Flags::default()
}
@@ -3825,7 +3872,7 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Test {
+ subcommand: DenoSubcommand::Test(TestFlags {
no_run: false,
doc: false,
fail_fast: None,
@@ -3835,7 +3882,7 @@ mod tests {
include: None,
ignore: vec![],
concurrent_jobs: NonZeroUsize::new(1).unwrap(),
- },
+ }),
watch: false,
..Flags::default()
}
@@ -3848,7 +3895,7 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Test {
+ subcommand: DenoSubcommand::Test(TestFlags {
no_run: false,
doc: false,
fail_fast: None,
@@ -3858,7 +3905,7 @@ mod tests {
include: None,
ignore: vec![],
concurrent_jobs: NonZeroUsize::new(1).unwrap(),
- },
+ }),
watch: true,
..Flags::default()
}
@@ -3877,10 +3924,10 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Bundle {
+ subcommand: DenoSubcommand::Bundle(BundleFlags {
source_file: "source.ts".to_string(),
out_file: None,
- },
+ }),
ca_file: Some("example.crt".to_owned()),
..Flags::default()
}
@@ -3893,14 +3940,14 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Upgrade {
+ subcommand: DenoSubcommand::Upgrade(UpgradeFlags {
force: false,
dry_run: false,
canary: false,
version: None,
output: None,
ca_file: Some("example.crt".to_owned()),
- },
+ }),
ca_file: Some("example.crt".to_owned()),
..Flags::default()
}
@@ -3920,9 +3967,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Cache {
+ subcommand: DenoSubcommand::Cache(CacheFlags {
files: svec!["script.ts", "script_two.ts"],
- },
+ }),
ca_file: Some("example.crt".to_owned()),
..Flags::default()
}
@@ -3941,10 +3988,10 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Info {
+ subcommand: DenoSubcommand::Info(InfoFlags {
json: false,
file: Some("https://example.com".to_string()),
- },
+ }),
ca_file: Some("example.crt".to_owned()),
..Flags::default()
}
@@ -3957,12 +4004,12 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Doc {
+ subcommand: DenoSubcommand::Doc(DocFlags {
private: false,
json: true,
source_file: Some("path/to/module.ts".to_string()),
filter: None,
- },
+ }),
..Flags::default()
}
);
@@ -3976,12 +4023,12 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Doc {
+ subcommand: DenoSubcommand::Doc(DocFlags {
private: false,
json: false,
source_file: Some("path/to/module.ts".to_string()),
filter: Some("SomeClass.someField".to_string()),
- },
+ }),
..Flags::default()
}
);
@@ -3990,12 +4037,12 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Doc {
+ subcommand: DenoSubcommand::Doc(DocFlags {
private: false,
json: false,
source_file: None,
filter: None,
- },
+ }),
..Flags::default()
}
);
@@ -4004,12 +4051,12 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Doc {
+ subcommand: DenoSubcommand::Doc(DocFlags {
private: false,
json: false,
source_file: Some("--builtin".to_string()),
filter: Some("Deno.Listener".to_string()),
- },
+ }),
..Flags::default()
}
);
@@ -4019,12 +4066,12 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Doc {
+ subcommand: DenoSubcommand::Doc(DocFlags {
private: true,
json: false,
source_file: Some("path/to/module.js".to_string()),
filter: None,
- },
+ }),
..Flags::default()
}
);
@@ -4036,9 +4083,9 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Run {
+ subcommand: DenoSubcommand::Run(RunFlags {
script: "foo.js".to_string(),
- },
+ }),
inspect: Some("127.0.0.1:9229".parse().unwrap()),
..Flags::default()
}
@@ -4055,12 +4102,12 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Compile {
+ subcommand: DenoSubcommand::Compile(CompileFlags {
source_file: "https://deno.land/std/examples/colors.ts".to_string(),
output: None,
args: vec![],
target: None,
- },
+ }),
..Flags::default()
}
);
@@ -4073,12 +4120,12 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Compile {
+ subcommand: DenoSubcommand::Compile(CompileFlags {
source_file: "https://deno.land/std/examples/colors.ts".to_string(),
output: Some(PathBuf::from("colors")),
args: svec!["foo", "bar"],
target: None,
- },
+ }),
import_map_path: Some("import_map.json".to_string()),
no_remote: true,
config_path: Some("tsconfig.json".to_string()),
@@ -4105,13 +4152,13 @@ mod tests {
assert_eq!(
r.unwrap(),
Flags {
- subcommand: DenoSubcommand::Coverage {
+ subcommand: DenoSubcommand::Coverage(CoverageFlags {
files: vec![PathBuf::from("foo.json")],
ignore: vec![],
include: vec![r"^file:".to_string()],
exclude: vec![r"test\.(js|mjs|ts|jsx|tsx)$".to_string()],
lcov: false,
- },
+ }),
..Flags::default()
}
);