File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,20 +11,16 @@ fn main() -> Result<(), Error> {
1111 let cli = Cli :: parse ( ) ;
1212 if let Err ( e) = cli. run ( ) {
1313 log:: error ( & e. to_string ( ) ) ;
14- if let Some ( suggestion) = get_suggestion ( & e) {
15- log:: warning ( suggestion) ;
14+ match e {
15+ Error :: CliError ( CliError :: RepositoryExists ) => {
16+ log:: warning ( "Try removing the existing directory or use a different path." )
17+ }
18+ Error :: CliError ( CliError :: InvalidUsage ) => {
19+ log:: warning ( "Run 'dm help' for usage information." )
20+ }
21+ Error :: CliError ( CliError :: CancelledByUser ) => log:: warning ( "No changes were made." ) ,
22+ _ => { }
1623 }
1724 }
1825 Ok ( ( ) )
1926}
20-
21- fn get_suggestion ( e : & Error ) -> Option < & ' static str > {
22- match e {
23- Error :: CliError ( CliError :: RepositoryExists ) => {
24- Some ( "Try removing the existing directory or use a different path." )
25- }
26- Error :: CliError ( CliError :: InvalidUsage ) => Some ( "Run 'dm help' for usage information." ) ,
27- Error :: CliError ( CliError :: CancelledByUser ) => Some ( "No changes were made." ) ,
28- _ => None ,
29- }
30- }
You can’t perform that action at this time.
0 commit comments