@@ -7,15 +7,19 @@ mod command;
77mod config;
88mod fmt;
99mod help;
10+ mod publish;
1011mod version;
1112mod watch;
1213
13- pub ( crate ) use { bump:: * , command:: * , config:: * , fmt:: * , help:: * , version:: * , watch:: * } ;
14+ pub ( crate ) use {
15+ bump:: * , command:: * , config:: * , fmt:: * , help:: * , publish:: * , version:: * , watch:: * ,
16+ } ;
1417
1518pub ( crate ) use std:: {
19+ collections:: { HashMap , VecDeque } ,
1620 env:: args,
1721 fs:: { read_to_string, write} ,
18- path:: Path ,
22+ path:: { Path , PathBuf } ,
1923 process:: { ExitStatus , Stdio , exit} ,
2024} ;
2125
@@ -52,6 +56,30 @@ async fn main() {
5256 }
5357 }
5458 }
59+ CommandType :: Publish => {
60+ let manifest_path: String = args
61+ . manifest_path
62+ . unwrap_or_else ( || "Cargo.toml" . to_string ( ) ) ;
63+ let max_retries: u32 = args. max_retries ;
64+ match execute_publish ( & manifest_path, max_retries) . await {
65+ Ok ( results) => {
66+ let failed_count: usize = results
67+ . iter ( )
68+ . filter ( |r : & & PublishResult | !r. success )
69+ . count ( ) ;
70+ if failed_count > 0 {
71+ eprintln ! ( "Publish completed with {failed_count} failures" ) ;
72+ exit ( 1 ) ;
73+ } else {
74+ println ! ( "All packages published successfully" ) ;
75+ }
76+ }
77+ Err ( error) => {
78+ eprintln ! ( "publish failed: {error}" ) ;
79+ exit ( 1 ) ;
80+ }
81+ }
82+ }
5583 CommandType :: Help => print_help ( ) ,
5684 CommandType :: Version => print_version ( ) ,
5785 }
0 commit comments