diff options
Diffstat (limited to 'cli/args/flags.rs')
-rw-r--r-- | cli/args/flags.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs index ca285112e..fa8471deb 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -302,6 +302,7 @@ pub struct PublishFlags { pub token: Option<String>, pub dry_run: bool, pub allow_slow_types: bool, + pub provenance: bool, } #[derive(Clone, Debug, Eq, PartialEq)] @@ -2395,6 +2396,12 @@ fn publish_subcommand() -> Command { .help("Allow publishing with slow types") .action(ArgAction::SetTrue), ) + .arg( + Arg::new("provenance") + .long("provenance") + .help("From CI/CD system, publicly links the package to where it was built and published from.") + .action(ArgAction::SetTrue) + ) .arg(check_arg(/* type checks by default */ true)) .arg(no_check_arg()) }) @@ -3835,6 +3842,7 @@ fn publish_parse(flags: &mut Flags, matches: &mut ArgMatches) { token: matches.remove_one("token"), dry_run: matches.get_flag("dry-run"), allow_slow_types: matches.get_flag("allow-slow-types"), + provenance: matches.get_flag("provenance"), }); } @@ -8565,6 +8573,26 @@ mod tests { token: Some("asdf".to_string()), dry_run: true, allow_slow_types: true, + provenance: false, + }), + type_check_mode: TypeCheckMode::Local, + ..Flags::default() + } + ); + } + + #[test] + fn publish_provenance_args() { + let r = + flags_from_vec(svec!["deno", "publish", "--provenance", "--token=asdf",]); + assert_eq!( + r.unwrap(), + Flags { + subcommand: DenoSubcommand::Publish(PublishFlags { + token: Some("asdf".to_string()), + dry_run: false, + allow_slow_types: false, + provenance: true, }), type_check_mode: TypeCheckMode::Local, ..Flags::default() |