@@ -77,19 +77,6 @@ pub fn main() {
77
77
. subcommand ( SubCommand :: with_name ( "unlock" )
78
78
. about ( "Unlocks cratesfyi daemon to continue building new crates" ) )
79
79
. subcommand ( SubCommand :: with_name ( "print-options" ) ) )
80
- . subcommand ( SubCommand :: with_name ( "blacklist" )
81
- . about ( "Blacklist operations" )
82
- . setting ( AppSettings :: ArgRequiredElseHelp )
83
- . subcommand ( SubCommand :: with_name ( "add" )
84
- . about ( "Add a crate to the blacklist" )
85
- . arg ( Arg :: with_name ( "CRATE_NAME" )
86
- . required ( true )
87
- . help ( "Crate name" ) ) )
88
- . subcommand ( SubCommand :: with_name ( "remove" )
89
- . about ( "Remove a crate from the blacklist" )
90
- . arg ( Arg :: with_name ( "CRATE_NAME" )
91
- . required ( true )
92
- . help ( "Crate name" ) ) ) )
93
80
. subcommand ( SubCommand :: with_name ( "start-web-server" )
94
81
. about ( "Starts web server" )
95
82
. arg ( Arg :: with_name ( "SOCKET_ADDR" )
@@ -129,7 +116,20 @@ pub fn main() {
129
116
. arg ( Arg :: with_name ( "CRATE_NAME" )
130
117
. takes_value ( true )
131
118
. required ( true )
132
- . help ( "Name of the crate to delete" ) ) ) )
119
+ . help ( "Name of the crate to delete" ) ) )
120
+ . subcommand ( SubCommand :: with_name ( "blacklist" )
121
+ . about ( "Blacklist operations" )
122
+ . setting ( AppSettings :: ArgRequiredElseHelp )
123
+ . subcommand ( SubCommand :: with_name ( "add" )
124
+ . about ( "Add a crate to the blacklist" )
125
+ . arg ( Arg :: with_name ( "CRATE_NAME" )
126
+ . required ( true )
127
+ . help ( "Crate name" ) ) )
128
+ . subcommand ( SubCommand :: with_name ( "remove" )
129
+ . about ( "Remove a crate from the blacklist" )
130
+ . arg ( Arg :: with_name ( "CRATE_NAME" )
131
+ . required ( true )
132
+ . help ( "Crate name" ) ) ) ) )
133
133
. subcommand ( SubCommand :: with_name ( "queue" )
134
134
. about ( "Interactions with the build queue" )
135
135
. setting ( AppSettings :: ArgRequiredElseHelp )
@@ -213,18 +213,6 @@ pub fn main() {
213
213
println ! ( "{:?}" , docbuilder. options( ) ) ;
214
214
}
215
215
216
- } else if let Some ( matches) = matches. subcommand_matches ( "blacklist" ) {
217
- let conn = db:: connect_db ( ) . expect ( "Failed to connect to the database" ) ;
218
-
219
- if let Some ( matches) = matches. subcommand_matches ( "add" ) {
220
- let crate_name = matches. value_of ( "CRATE_NAME" ) . expect ( "Verified by clap" ) ;
221
- db:: blacklist:: add_crate ( & conn, crate_name) . expect ( "Failed to add crate to blacklist" ) ;
222
-
223
- } else if let Some ( matches) = matches. subcommand_matches ( "remove" ) {
224
- let crate_name = matches. value_of ( "CRATE_NAME" ) . expect ( "Verified by clap" ) ;
225
- db:: blacklist:: remove_crate ( & conn, crate_name) . expect ( "Failed to remove crate from blacklist" ) ;
226
- }
227
-
228
216
} else if let Some ( matches) = matches. subcommand_matches ( "database" ) {
229
217
if let Some ( matches) = matches. subcommand_matches ( "migrate" ) {
230
218
let version = matches. value_of ( "VERSION" ) . map ( |v| v. parse :: < i64 > ( )
@@ -260,6 +248,17 @@ pub fn main() {
260
248
let name = matches. value_of ( "CRATE_NAME" ) . expect ( "missing crate name" ) ;
261
249
let conn = db:: connect_db ( ) . expect ( "failed to connect to the database" ) ;
262
250
db:: delete_crate ( & conn, & name) . expect ( "failed to delete the crate" ) ;
251
+ } else if let Some ( matches) = matches. subcommand_matches ( "blacklist" ) {
252
+ let conn = db:: connect_db ( ) . expect ( "failed to connect to the database" ) ;
253
+
254
+ if let Some ( matches) = matches. subcommand_matches ( "add" ) {
255
+ let crate_name = matches. value_of ( "CRATE_NAME" ) . expect ( "verified by clap" ) ;
256
+ db:: blacklist:: add_crate ( & conn, crate_name) . expect ( "failed to add crate to blacklist" ) ;
257
+
258
+ } else if let Some ( matches) = matches. subcommand_matches ( "remove" ) {
259
+ let crate_name = matches. value_of ( "CRATE_NAME" ) . expect ( "verified by clap" ) ;
260
+ db:: blacklist:: remove_crate ( & conn, crate_name) . expect ( "failed to remove crate from blacklist" ) ;
261
+ }
263
262
}
264
263
265
264
} else if let Some ( matches) = matches. subcommand_matches ( "start-web-server" ) {
0 commit comments