From 6e1f3aa0131f145db631d5dfb94c2b9404172194 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 13 Nov 2023 09:44:01 -0500 Subject: fix(install): should work with non-existent relative root (#21161) Closes #21160 --- cli/args/flags.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'cli/args') diff --git a/cli/args/flags.rs b/cli/args/flags.rs index 4bad30140..96cd0bbfe 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -163,7 +163,7 @@ pub struct InstallFlags { pub module_url: String, pub args: Vec, pub name: Option, - pub root: Option, + pub root: Option, pub force: bool, } @@ -177,7 +177,7 @@ pub struct JupyterFlags { #[derive(Clone, Debug, Eq, PartialEq)] pub struct UninstallFlags { pub name: String, - pub root: Option, + pub root: Option, } #[derive(Clone, Debug, Eq, PartialEq)] @@ -1762,7 +1762,6 @@ These must be added to the path manually if required.") Arg::new("root") .long("root") .help("Installation root") - .value_parser(value_parser!(PathBuf)) .value_hint(ValueHint::DirPath)) .arg( Arg::new("force") @@ -1822,7 +1821,6 @@ The installation root is determined, in order of precedence: Arg::new("root") .long("root") .help("Installation root") - .value_parser(value_parser!(PathBuf)) .value_hint(ValueHint::DirPath)) ) } @@ -3407,7 +3405,7 @@ fn info_parse(flags: &mut Flags, matches: &mut ArgMatches) { fn install_parse(flags: &mut Flags, matches: &mut ArgMatches) { runtime_args_parse(flags, matches, true, true); - let root = matches.remove_one::("root"); + let root = matches.remove_one::("root"); let force = matches.get_flag("force"); let name = matches.remove_one::("name"); @@ -3438,7 +3436,7 @@ fn jupyter_parse(flags: &mut Flags, matches: &mut ArgMatches) { } fn uninstall_parse(flags: &mut Flags, matches: &mut ArgMatches) { - let root = matches.remove_one::("root"); + let root = matches.remove_one::("root"); let name = matches.remove_one::("name").unwrap(); flags.subcommand = DenoSubcommand::Uninstall(UninstallFlags { name, root }); @@ -6361,7 +6359,7 @@ mod tests { 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")), + root: Some("/foo".to_string()), force: true, }), import_map_path: Some("import_map.json".to_string()), -- cgit v1.2.3