Repository: denoland/deno
File: cli/args/flags.rs (Rust)

Code before:
  lock_args_parse(flags, matches);
  flags.subcommand = DenoSubcommand::Add(add_parse_inner(matches, None));
  Ok(())
}

fn add_parse_inner(
  matches: &mut ArgMatches,
  packages: Option<clap::parser::Values<String>>,
) -> AddFlags {
  let packages = packages
    .unwrap_or_else(|| matches.remove_many::<String>("packages").unwrap())
    .collect();
  let dev = matches.get_flag("dev");
  let default_registry = if matches.get_flag("npm") {
    Some(DefaultRegistry::Npm)
  } else if matches.get_flag("jsr") {
    Some(DefaultRegistry::Jsr)
  } else {
    None
  };
  AddFlags {
    packages,
    dev,
    default_registry,
    lockfile_only: matches.get_flag("lockfile-only"),
    save_exact: matches.get_flag("save_exact"),
  }
}

fn remove_parse(flags: &mut Flags, matches: &mut ArgMatches) {
  lock_args_parse(flags, matches);
  flags.subcommand = DenoSubcommand::Remove(RemoveFlags {
    packages: matches.remove_many::<String>("packages").unwrap().collect(),
    lockfile_only: matches.get_flag("lockfile-only"),
  });
}

fn outdated_parse(
  flags: &mut Flags,
  matches: &mut ArgMatches,
  is_update_command: bool,
) -> clap::error::Result<()> {
  let filters = match matches.remove_many::<String>("filters") {
    Some(f) => f.collect(),
    None => vec![],
  };
  let recursive = matches.get_flag("recursive");
  let update = is_update_command || matches.get_flag("update");
  let kind = if update {
    let latest = matches.get_flag("latest");
    let interactive = matches.get_flag("interactive");

Review comment (suggestion):
```suggestion
    save_exact: matches.get_flag("save-exact"),
```

Code after:
  lock_args_parse(flags, matches);
  flags.subcommand = DenoSubcommand::Add(add_parse_inner(matches, None));
  Ok(())
}

fn add_parse_inner(
  matches: &mut ArgMatches,
  packages: Option<clap::parser::Values<String>>,
) -> AddFlags {
  let packages = packages
    .unwrap_or_else(|| matches.remove_many::<String>("packages").unwrap())
    .collect();
  let dev = matches.get_flag("dev");
  let default_registry = if matches.get_flag("npm") {
    Some(DefaultRegistry::Npm)
  } else if matches.get_flag("jsr") {
    Some(DefaultRegistry::Jsr)
  } else {
    None
  };
  AddFlags {
    packages,
    dev,
    default_registry,
    lockfile_only: matches.get_flag("lockfile-only"),
    save_exact: matches.get_flag("save-exact"),
  }
}

fn remove_parse(flags: &mut Flags, matches: &mut ArgMatches) {
  lock_args_parse(flags, matches);
  flags.subcommand = DenoSubcommand::Remove(RemoveFlags {
    packages: matches.remove_many::<String>("packages").unwrap().collect(),
    lockfile_only: matches.get_flag("lockfile-only"),
  });
}

fn outdated_parse(
  flags: &mut Flags,
  matches: &mut ArgMatches,
  is_update_command: bool,
) -> clap::error::Result<()> {
  let filters = match matches.remove_many::<String>("filters") {
    Some(f) => f.collect(),
    None => vec![],
  };
  let recursive = matches.get_flag("recursive");
  let update = is_update_command || matches.get_flag("update");
  let kind = if update {
    let latest = matches.get_flag("latest");
    let interactive = matches.get_flag("interactive");