@@ -398,6 +398,7 @@ pub struct TestFlags {
398
398
pub struct UpgradeFlags {
399
399
pub dry_run : bool ,
400
400
pub force : bool ,
401
+ pub release_candidate : bool ,
401
402
pub canary : bool ,
402
403
pub version : Option < String > ,
403
404
pub output : Option < String > ,
@@ -2908,6 +2909,13 @@ update to a different location, use the --output flag:
2908
2909
. help ( "Upgrade to canary builds" )
2909
2910
. action ( ArgAction :: SetTrue ) ,
2910
2911
)
2912
+ . arg (
2913
+ Arg :: new ( "release-candidate" )
2914
+ . long ( "rc" )
2915
+ . help ( "Upgrade to a release candidate" )
2916
+ . conflicts_with_all ( [ "canary" , "version" ] )
2917
+ . action ( ArgAction :: SetTrue ) ,
2918
+ )
2911
2919
. arg ( ca_file_arg ( ) )
2912
2920
} )
2913
2921
}
@@ -4568,11 +4576,13 @@ fn upgrade_parse(flags: &mut Flags, matches: &mut ArgMatches) {
4568
4576
let dry_run = matches. get_flag ( "dry-run" ) ;
4569
4577
let force = matches. get_flag ( "force" ) ;
4570
4578
let canary = matches. get_flag ( "canary" ) ;
4579
+ let release_candidate = matches. get_flag ( "release-candidate" ) ;
4571
4580
let version = matches. remove_one :: < String > ( "version" ) ;
4572
4581
let output = matches. remove_one :: < String > ( "output" ) ;
4573
4582
flags. subcommand = DenoSubcommand :: Upgrade ( UpgradeFlags {
4574
4583
dry_run,
4575
4584
force,
4585
+ release_candidate,
4576
4586
canary,
4577
4587
version,
4578
4588
output,
@@ -5057,6 +5067,7 @@ mod tests {
5057
5067
force: true ,
5058
5068
dry_run: true ,
5059
5069
canary: false ,
5070
+ release_candidate: false ,
5060
5071
version: None ,
5061
5072
output: None ,
5062
5073
} ) ,
@@ -5075,6 +5086,7 @@ mod tests {
5075
5086
force: false ,
5076
5087
dry_run: false ,
5077
5088
canary: false ,
5089
+ release_candidate: false ,
5078
5090
version: None ,
5079
5091
output: Some ( String :: from( "example.txt" ) ) ,
5080
5092
} ) ,
@@ -9039,6 +9051,7 @@ mod tests {
9039
9051
force: false ,
9040
9052
dry_run: false ,
9041
9053
canary: false ,
9054
+ release_candidate: false ,
9042
9055
version: None ,
9043
9056
output: None ,
9044
9057
} ) ,
@@ -9048,6 +9061,31 @@ mod tests {
9048
9061
) ;
9049
9062
}
9050
9063
9064
+ #[ test]
9065
+ fn upgrade_release_candidate ( ) {
9066
+ let r = flags_from_vec ( svec ! [ "deno" , "upgrade" , "--rc" ] ) ;
9067
+ assert_eq ! (
9068
+ r. unwrap( ) ,
9069
+ Flags {
9070
+ subcommand: DenoSubcommand :: Upgrade ( UpgradeFlags {
9071
+ force: false ,
9072
+ dry_run: false ,
9073
+ canary: false ,
9074
+ release_candidate: true ,
9075
+ version: None ,
9076
+ output: None ,
9077
+ } ) ,
9078
+ ..Flags :: default ( )
9079
+ }
9080
+ ) ;
9081
+
9082
+ let r = flags_from_vec ( svec ! [ "deno" , "upgrade" , "--rc" , "--canary" ] ) ;
9083
+ assert ! ( r. is_err( ) ) ;
9084
+
9085
+ let r = flags_from_vec ( svec ! [ "deno" , "upgrade" , "--rc" , "--version" ] ) ;
9086
+ assert ! ( r. is_err( ) ) ;
9087
+ }
9088
+
9051
9089
#[ test]
9052
9090
fn cache_with_cafile ( ) {
9053
9091
let r = flags_from_vec ( svec ! [
0 commit comments