@@ -38,11 +38,17 @@ struct ReleaseNotes {
38
38
}
39
39
40
40
fn main ( ) {
41
- let mut args = env:: args ( ) ;
42
- let _ = args. next ( ) ;
43
- let version = args
44
- . next ( )
45
- . expect ( "A version number (xx.yy.zz) for the Rust release is required." ) ;
41
+ let mut draft = false ;
42
+ let mut opt_version = None ;
43
+ for arg in env:: args ( ) . skip ( 1 ) {
44
+ match arg. as_bytes ( ) {
45
+ b"--draft" => draft = true ,
46
+ [ b'1' , b'.' , ..] => opt_version = Some ( arg) ,
47
+ _ => panic ! ( "unrecognized argument: {arg:?}" ) ,
48
+ }
49
+ }
50
+ let version =
51
+ opt_version. expect ( "A version number (xx.yy.zz) for the Rust release is required." ) ;
46
52
let today = Utc :: now ( ) . date_naive ( ) ;
47
53
48
54
// A known rust release date. (1.42.0)
@@ -86,7 +92,7 @@ fn main() {
86
92
compat_relnotes,
87
93
internal_changes_relnotes,
88
94
other_relnotes,
89
- } = to_sections ( relnotes, & mut tracking_rust) ;
95
+ } = to_sections ( relnotes, & mut tracking_rust, draft ) ;
90
96
91
97
let cargo_issues = get_issues_by_milestone ( & version, "cargo" ) ;
92
98
@@ -357,6 +363,7 @@ fn map_to_line_items<'a>(
357
363
iter : impl IntoIterator < Item = & ' a json:: Value > ,
358
364
tracking_issues : & mut TrackingIssues ,
359
365
by_section : & mut HashMap < & ' static str , String > ,
366
+ draft : bool ,
360
367
) {
361
368
for o in iter {
362
369
let title = o[ "title" ] . as_str ( ) . unwrap ( ) ;
@@ -381,6 +388,12 @@ fn map_to_line_items<'a>(
381
388
contents. push_str ( line) ;
382
389
contents. push ( '\n' ) ;
383
390
}
391
+ if draft {
392
+ contents. push_str ( & format ! (
393
+ " [:pencil:]({})\n " ,
394
+ issue. raw[ "url" ] . as_str( ) . unwrap( ) ,
395
+ ) ) ;
396
+ }
384
397
}
385
398
}
386
399
@@ -435,6 +448,7 @@ struct Sections {
435
448
fn to_sections < ' a > (
436
449
iter : impl IntoIterator < Item = & ' a json:: Value > ,
437
450
mut tracking : & mut TrackingIssues ,
451
+ draft : bool ,
438
452
) -> Sections {
439
453
let mut by_section = HashMap :: new ( ) ;
440
454
by_section. insert ( "Language" , String :: new ( ) ) ;
@@ -448,7 +462,7 @@ fn to_sections<'a>(
448
462
by_section. insert ( "Platform Support" , String :: new ( ) ) ;
449
463
by_section. insert ( "Other" , String :: new ( ) ) ;
450
464
451
- map_to_line_items ( iter, & mut tracking, & mut by_section) ;
465
+ map_to_line_items ( iter, & mut tracking, & mut by_section, draft ) ;
452
466
453
467
Sections {
454
468
language_relnotes : by_section. remove ( "Language" ) . unwrap ( ) ,
0 commit comments