diff options
author | simwipado <56857885+simwipado@users.noreply.github.com> | 2020-07-12 23:05:47 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-12 15:05:47 +0200 |
commit | e1d814055281ee2781dfda93cf8b2637b8d65800 (patch) | |
tree | 01f75b5a2762128d33fc74a8e60fa4077db21d0b /cli/flags.rs | |
parent | 3374c73fba3a96df22d0c04e6c17078ca8cce45b (diff) |
feat(install): add --config flag (#6204)
This commits adds support for "--config" flag in "deno install"
subcommand. Specified configuration file is copied alongside
source code to installation directory.
Diffstat (limited to 'cli/flags.rs')
-rw-r--r-- | cli/flags.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/cli/flags.rs b/cli/flags.rs index 80e856581..7d9ba8fdb 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -349,6 +349,7 @@ fn fmt_parse(flags: &mut Flags, matches: &clap::ArgMatches) { fn install_parse(flags: &mut Flags, matches: &clap::ArgMatches) { permission_args_parse(flags, matches); + config_arg_parse(flags, matches); ca_file_arg_parse(flags, matches); unstable_arg_parse(flags, matches); @@ -701,6 +702,7 @@ fn install_subcommand<'a, 'b>() -> App<'a, 'b> { .takes_value(false)) .arg(ca_file_arg()) .arg(unstable_arg()) + .arg(config_arg()) .about("Install script as an executable") .long_about( "Installs a script as an executable in the installation root's bin directory. @@ -2372,6 +2374,32 @@ mod tests { } #[test] + fn install_with_config() { + let r = flags_from_vec_safe(svec![ + "deno", + "install", + "--config", + "tsconfig.json", + "https://deno.land/std/examples/colors.ts" + ]); + + assert_eq!( + r.unwrap(), + Flags { + subcommand: DenoSubcommand::Install { + name: None, + module_url: "https://deno.land/std/examples/colors.ts".to_string(), + args: svec![], + root: None, + force: false, + }, + config_path: Some("tsconfig.json".to_owned()), + ..Flags::default() + } + ) + } + + #[test] fn install_with_args_and_dir_and_force() { let r = flags_from_vec_safe(svec![ "deno", |