@@ -318,27 +318,30 @@ pub fn main() {
318
318
priority,
319
319
)
320
320
. expect ( "Could not add crate to queue" ) ;
321
- } else if let Some ( matches) = matches. subcommand_matches ( "set" ) {
322
- let pattern = matches
323
- . value_of ( "PATTERN" )
324
- . expect ( "You must give a pattern to match with" ) ;
325
- let priority = clap:: value_t!( matches. value_of( "PRIORITY" ) , i32 )
326
- . expect ( "You must give a priority for a crate" ) ;
327
- let conn = connect_db ( ) . expect ( "Could not connect to the database" ) ;
321
+ } else if let Some ( matches) = matches. subcommand_matches ( "default-priority" ) {
322
+ if let Some ( matches) = matches. subcommand_matches ( "set" ) {
323
+ let pattern = matches
324
+ . value_of ( "PATTERN" )
325
+ . expect ( "You must give a pattern to match with" ) ;
326
+ let priority = clap:: value_t!( matches. value_of( "PRIORITY" ) , i32 )
327
+ . expect ( "You must give a priority for a crate" ) ;
328
+ let conn = connect_db ( ) . expect ( "Could not connect to the database" ) ;
328
329
329
- set_crate_priority ( & conn, pattern, priority) . expect ( "Could not set pattern's priority" ) ;
330
- } else if let Some ( matches) = matches. subcommand_matches ( "remove" ) {
331
- let pattern = matches
332
- . value_of ( "PATTERN" )
333
- . expect ( "You must give a pattern to remove" ) ;
334
- let conn = connect_db ( ) . expect ( "Could not connect to the database" ) ;
330
+ set_crate_priority ( & conn, pattern, priority)
331
+ . expect ( "Could not set pattern's priority" ) ;
332
+ } else if let Some ( matches) = matches. subcommand_matches ( "remove" ) {
333
+ let pattern = matches
334
+ . value_of ( "PATTERN" )
335
+ . expect ( "You must give a pattern to remove" ) ;
336
+ let conn = connect_db ( ) . expect ( "Could not connect to the database" ) ;
335
337
336
- if let Some ( priority) =
337
- remove_crate_priority ( & conn, pattern) . expect ( "Could not remove pattern's priority" )
338
- {
339
- println ! ( "Removed pattern with priority {}" , priority) ;
340
- } else {
341
- println ! ( "Pattern did not exist and so was not removed" ) ;
338
+ if let Some ( priority) = remove_crate_priority ( & conn, pattern)
339
+ . expect ( "Could not remove pattern's priority" )
340
+ {
341
+ println ! ( "Removed pattern with priority {}" , priority) ;
342
+ } else {
343
+ println ! ( "Pattern did not exist and so was not removed" ) ;
344
+ }
342
345
}
343
346
}
344
347
}
0 commit comments