Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Feb 12, 2022
1 parent 799d3b4 commit 45008c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 55 deletions.
54 changes: 4 additions & 50 deletions cli/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl Default for CheckFlag {
}
}

#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Default)]
pub struct Flags {
/// Vector of CLI arguments - these are user script arguments, all Deno
/// specific flags are removed.
Expand Down Expand Up @@ -245,7 +245,7 @@ pub struct Flags {
/// If true, a list of Node built-in modules will be injected into
/// the import map.
pub compat: bool,
pub prompt: bool,
pub no_prompt: bool,
pub reload: bool,
pub repl: bool,
pub seed: Option<u64>,
Expand All @@ -257,52 +257,6 @@ pub struct Flags {
pub no_clear_screen: bool,
}

impl Default for Flags {
fn default() -> Flags {
Flags {
argv: Vec::new(),
subcommand: DenoSubcommand::default(),
allow_all: false,
allow_env: None,
allow_hrtime: false,
allow_net: None,
allow_ffi: None,
allow_read: None,
allow_run: None,
allow_write: None,
ca_stores: None,
ca_file: None,
cache_blocklist: Vec::new(),
cache_path: None,
cached_only: false,
check: CheckFlag::default(),
config_path: None,
coverage_dir: None,
enable_testing_features: false,
ignore: Vec::new(),
import_map_path: None,
inspect_brk: None,
inspect: None,
location: None,
lock_write: false,
lock: None,
log_level: None,
no_remote: false,
compat: false,
prompt: true,
reload: false,
repl: false,
seed: None,
unstable: false,
unsafely_ignore_certificate_errors: None,
v8_flags: Vec::new(),
version: false,
watch: None,
no_clear_screen: false,
}
}
}

fn join_paths(allowlist: &[PathBuf], d: &str) -> String {
allowlist
.iter()
Expand Down Expand Up @@ -442,7 +396,7 @@ impl From<Flags> for PermissionsOptions {
allow_read: flags.allow_read,
allow_run: flags.allow_run,
allow_write: flags.allow_write,
prompt: flags.prompt,
prompt: !flags.no_prompt,
}
}
}
Expand Down Expand Up @@ -2339,7 +2293,7 @@ fn permission_args_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
flags.allow_hrtime = true;
}
if matches.is_present("no-prompt") {
flags.prompt = false;
flags.no_prompt = true;
}
}
fn unsafely_ignore_certificate_errors_parse(
Expand Down
8 changes: 4 additions & 4 deletions cli/tools/installer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ fn resolve_shim_data(
executable_args.push("--cached-only".to_string());
}

if flags.prompt {
executable_args.push("--prompt".to_string());
if flags.no_prompt {
executable_args.push("--no-prompt".to_string());
}

if !flags.v8_flags.is_empty() {
Expand Down Expand Up @@ -714,7 +714,7 @@ mod tests {
fn install_prompt() {
let shim_data = resolve_shim_data(
&Flags {
prompt: true,
no_prompt: true,
..Flags::default()
},
&InstallFlags {
Expand All @@ -729,7 +729,7 @@ mod tests {

assert_eq!(
shim_data.args,
vec!["run", "--prompt", "http://localhost:4545/echo_server.ts",]
vec!["run", "--no-prompt", "http://localhost:4545/echo_server.ts",]
);
}

Expand Down
2 changes: 1 addition & 1 deletion cli/tools/standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ pub fn compile_to_runtime_flags(
unsafely_ignore_certificate_errors: flags
.unsafely_ignore_certificate_errors,
no_remote: false,
prompt: flags.prompt,
no_prompt: flags.no_prompt,
reload: false,
repl: false,
seed: flags.seed,
Expand Down

0 comments on commit 45008c4

Please sign in to comment.