@@ -10,7 +10,7 @@ mod validation;
10
10
11
11
use {
12
12
anyhow:: { anyhow, Context , Result } ,
13
- clap:: { App , AppSettings , Arg , SubCommand } ,
13
+ clap:: { Arg , Command } ,
14
14
std:: { io:: Read , path:: Path } ,
15
15
} ;
16
16
@@ -25,43 +25,43 @@ pub fn open_distribution_archive(path: &Path) -> Result<tar::Archive<impl Read>>
25
25
}
26
26
27
27
fn main_impl ( ) -> Result < ( ) > {
28
- let app = App :: new ( "Python Build" )
29
- . setting ( AppSettings :: ArgRequiredElseHelp )
28
+ let app = Command :: new ( "Python Build" )
29
+ . arg_required_else_help ( true )
30
30
. version ( "0.1" )
31
31
. author ( "Gregory Szorc <[email protected] >" )
32
32
. about ( "Perform tasks related to building Python distributions" ) ;
33
33
let app = app. subcommand (
34
- SubCommand :: with_name ( "fetch-release-distributions" )
34
+ Command :: new ( "fetch-release-distributions" )
35
35
. about ( "Fetch builds from GitHub Actions that are release artifacts" )
36
36
. arg (
37
- Arg :: with_name ( "token" )
37
+ Arg :: new ( "token" )
38
38
. long ( "--token" )
39
39
. required ( true )
40
40
. takes_value ( true )
41
41
. help ( "GitHub API token" ) ,
42
42
)
43
43
. arg (
44
- Arg :: with_name ( "commit" )
44
+ Arg :: new ( "commit" )
45
45
. long ( "--commit" )
46
46
. takes_value ( true )
47
47
. help ( "Git commit whose artifacts to fetch" ) ,
48
48
)
49
49
. arg (
50
- Arg :: with_name ( "dest" )
50
+ Arg :: new ( "dest" )
51
51
. long ( "dest" )
52
52
. required ( true )
53
53
. takes_value ( true )
54
54
. help ( "Destination directory" ) ,
55
55
)
56
56
. arg (
57
- Arg :: with_name ( "organization" )
57
+ Arg :: new ( "organization" )
58
58
. long ( "--org" )
59
59
. takes_value ( true )
60
60
. default_value ( "indygreg" )
61
61
. help ( "GitHub organization" ) ,
62
62
)
63
63
. arg (
64
- Arg :: with_name ( "repo" )
64
+ Arg :: new ( "repo" )
65
65
. long ( "--repo" )
66
66
. takes_value ( true )
67
67
. default_value ( "python-build-standalone" )
@@ -70,50 +70,50 @@ fn main_impl() -> Result<()> {
70
70
) ;
71
71
72
72
let app = app. subcommand (
73
- SubCommand :: with_name ( "upload-release-distributions" )
73
+ Command :: new ( "upload-release-distributions" )
74
74
. about ( "Upload release distributions to a GitHub release" )
75
75
. arg (
76
- Arg :: with_name ( "token" )
76
+ Arg :: new ( "token" )
77
77
. long ( "--token" )
78
78
. required ( true )
79
79
. takes_value ( true )
80
80
. help ( "GitHub API token" ) ,
81
81
)
82
82
. arg (
83
- Arg :: with_name ( "dist" )
83
+ Arg :: new ( "dist" )
84
84
. long ( "--dist" )
85
85
. required ( true )
86
86
. takes_value ( true )
87
87
. help ( "Directory with release artifacts" ) ,
88
88
)
89
89
. arg (
90
- Arg :: with_name ( "datetime" )
90
+ Arg :: new ( "datetime" )
91
91
. long ( "--datetime" )
92
92
. required ( true )
93
93
. takes_value ( true )
94
94
. help ( "Date/time tag associated with builds" ) ,
95
95
)
96
96
. arg (
97
- Arg :: with_name ( "tag" )
97
+ Arg :: new ( "tag" )
98
98
. long ( "--tag" )
99
99
. required ( true )
100
100
. takes_value ( true )
101
101
. help ( "Release tag" ) ,
102
102
)
103
103
. arg (
104
- Arg :: with_name ( "ignore_missing" )
104
+ Arg :: new ( "ignore_missing" )
105
105
. long ( "--ignore-missing" )
106
106
. help ( "Continue even if there are missing artifacts" ) ,
107
107
)
108
108
. arg (
109
- Arg :: with_name ( "organization" )
109
+ Arg :: new ( "organization" )
110
110
. long ( "--org" )
111
111
. takes_value ( true )
112
112
. default_value ( "indygreg" )
113
113
. help ( "GitHub organization" ) ,
114
114
)
115
115
. arg (
116
- Arg :: with_name ( "repo" )
116
+ Arg :: new ( "repo" )
117
117
. long ( "--repo" )
118
118
. takes_value ( true )
119
119
. default_value ( "python-build-standalone" )
@@ -122,39 +122,40 @@ fn main_impl() -> Result<()> {
122
122
) ;
123
123
124
124
let app = app. subcommand (
125
- SubCommand :: with_name ( "validate-distribution" )
125
+ Command :: new ( "validate-distribution" )
126
126
. about ( "Ensure a distribution archive conforms to standards" )
127
127
. arg (
128
- Arg :: with_name ( "run" )
128
+ Arg :: new ( "run" )
129
129
. long ( "--run" )
130
130
. help ( "Run the interpreter to verify behavior" ) ,
131
131
)
132
132
. arg (
133
- Arg :: with_name ( "path" )
133
+ Arg :: new ( "path" )
134
134
. help ( "Path to tar.zst file to validate" )
135
- . multiple ( true )
135
+ . multiple_occurrences ( true )
136
+ . multiple_values ( true )
136
137
. required ( true ) ,
137
138
) ,
138
139
) ;
139
140
140
141
let matches = app. get_matches ( ) ;
141
142
142
143
match matches. subcommand ( ) {
143
- ( "fetch-release-distributions" , Some ( args) ) => {
144
+ Some ( ( "fetch-release-distributions" , args) ) => {
144
145
tokio:: runtime:: Builder :: new_current_thread ( )
145
146
. enable_all ( )
146
147
. build ( )
147
148
. unwrap ( )
148
149
. block_on ( crate :: github:: command_fetch_release_distributions ( args) )
149
150
}
150
- ( "upload-release-distributions" , Some ( args) ) => {
151
+ Some ( ( "upload-release-distributions" , args) ) => {
151
152
tokio:: runtime:: Builder :: new_current_thread ( )
152
153
. enable_all ( )
153
154
. build ( )
154
155
. unwrap ( )
155
156
. block_on ( crate :: github:: command_upload_release_distributions ( args) )
156
157
}
157
- ( "validate-distribution" , Some ( args) ) => {
158
+ Some ( ( "validate-distribution" , args) ) => {
158
159
crate :: validation:: command_validate_distribution ( args)
159
160
}
160
161
_ => Err ( anyhow ! ( "invalid sub-command" ) ) ,
0 commit comments