1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-22 06:09:25 -05:00

fix(jupyter): allow unstable flags (#25483)

Closes #25463
This commit is contained in:
Leo Kettmeir 2024-09-06 03:11:59 -07:00 committed by GitHub
parent 5dedb49ac4
commit 56363e4f4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2461,7 +2461,7 @@ fn json_reference_subcommand() -> Command {
} }
fn jupyter_subcommand() -> Command { fn jupyter_subcommand() -> Command {
Command::new("jupyter") command("jupyter", "Deno kernel for Jupyter notebooks", UnstableArgsConfig::ResolutionAndRuntime)
.arg( .arg(
Arg::new("install") Arg::new("install")
.long("install") .long("install")
@ -2484,7 +2484,6 @@ fn jupyter_subcommand() -> Command {
.value_parser(value_parser!(String)) .value_parser(value_parser!(String))
.value_hint(ValueHint::FilePath) .value_hint(ValueHint::FilePath)
.conflicts_with("install")) .conflicts_with("install"))
.about("Deno kernel for Jupyter notebooks")
} }
fn uninstall_subcommand() -> Command { fn uninstall_subcommand() -> Command {
@ -4584,6 +4583,8 @@ fn json_reference_parse(
} }
fn jupyter_parse(flags: &mut Flags, matches: &mut ArgMatches) { fn jupyter_parse(flags: &mut Flags, matches: &mut ArgMatches) {
unstable_args_parse(flags, matches, UnstableArgsConfig::ResolutionAndRuntime);
let conn_file = matches.remove_one::<String>("conn"); let conn_file = matches.remove_one::<String>("conn");
let kernel = matches.get_flag("kernel"); let kernel = matches.get_flag("kernel");
let install = matches.get_flag("install"); let install = matches.get_flag("install");
@ -10746,6 +10747,35 @@ mod tests {
.contains("Note: Permission flags can only be used in a global setting")); .contains("Note: Permission flags can only be used in a global setting"));
} }
#[test]
fn jupyter_unstable_flags() {
let r = flags_from_vec(svec![
"deno",
"jupyter",
"--unstable-ffi",
"--unstable-bare-node-builtins",
"--unstable-worker-options"
]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Jupyter(JupyterFlags {
install: false,
kernel: false,
conn_file: None,
}),
unstable_config: UnstableConfig {
legacy_flag_enabled: false,
bare_node_builtins: true,
sloppy_imports: false,
features: svec!["ffi", "worker-options"],
},
..Flags::default()
}
);
}
#[test] #[test]
fn escape_and_split_commas_test() { fn escape_and_split_commas_test() {
assert_eq!(escape_and_split_commas("foo".to_string()).unwrap(), ["foo"]); assert_eq!(escape_and_split_commas("foo".to_string()).unwrap(), ["foo"]);