summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMirko Jotic <joticmirko@gmail.com>2018-09-02 18:50:46 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-09-06 10:42:07 -0400
commitfcdfacc2de72e52b3f82dbce37746d371c3ad3ab (patch)
tree59e21b83c723ec38e96d824521fe72d57b1f65d7 /src
parent7784b0e17e2d54fd130e274bdb3aba4a2d1b2e9a (diff)
Implementing --deps flag
- Adding a ModuleId type alias to specify original url or local file of dependency - Modifying ModuleMetaData class to contain ModuleId - Adding a --deps flag
Diffstat (limited to 'src')
-rw-r--r--src/flags.rs9
-rw-r--r--src/handlers.rs1
-rw-r--r--src/msg.fbs1
3 files changed, 8 insertions, 3 deletions
diff --git a/src/flags.rs b/src/flags.rs
index 1b6299e3c..13f065735 100644
--- a/src/flags.rs
+++ b/src/flags.rs
@@ -21,12 +21,12 @@ pub struct DenoFlags {
pub allow_write: bool,
pub allow_net: bool,
pub allow_env: bool,
+ pub deps_flag: bool,
}
pub fn print_usage() {
println!(
"Usage: deno script.ts
-
--allow-write Allow file system write access.
--allow-net Allow network access.
--allow-env Allow environment access.
@@ -34,7 +34,8 @@ pub fn print_usage() {
-r or --reload Reload cached remote resources.
-D or --log-debug Log debug output.
-h or --help Print this message.
---v8-options Print V8 command line options."
+--v8-options Print V8 command line options.
+--deps Print module dependencies."
);
}
@@ -54,6 +55,7 @@ pub fn set_flags(args: Vec<String>) -> (DenoFlags, Vec<String>) {
"--allow-write" => flags.allow_write = true,
"--allow-net" => flags.allow_net = true,
"--allow-env" => flags.allow_env = true,
+ "--deps" => flags.deps_flag = true,
"--" => break,
_ => unimplemented!(),
}
@@ -108,13 +110,14 @@ fn test_set_flags_2() {
#[test]
fn test_set_flags_3() {
let (flags, rest) =
- set_flags(svec!["deno", "-r", "script.ts", "--allow-write"]);
+ set_flags(svec!["deno", "-r", "--deps", "script.ts", "--allow-write"]);
assert_eq!(rest, svec!["deno", "script.ts"]);
assert_eq!(
flags,
DenoFlags {
reload: true,
allow_write: true,
+ deps_flag: true,
..DenoFlags::default()
}
);
diff --git a/src/handlers.rs b/src/handlers.rs
index 3e6623e3d..0cd5b7367 100644
--- a/src/handlers.rs
+++ b/src/handlers.rs
@@ -116,6 +116,7 @@ fn handle_start(
cwd: Some(cwd_off),
argv: Some(argv_off),
debug_flag: deno.flags.log_debug,
+ deps_flag: deno.flags.deps_flag,
..Default::default()
},
);
diff --git a/src/msg.fbs b/src/msg.fbs
index be9b07af7..e28e5559b 100644
--- a/src/msg.fbs
+++ b/src/msg.fbs
@@ -87,6 +87,7 @@ table StartRes {
cwd: string;
argv: [string];
debug_flag: bool;
+ deps_flag: bool;
}
table CodeFetch {