rust/rhg/src/main.rs
branchstable
changeset 49568 05ef5f097df4
parent 49515 e84064e88e5d
child 49569 5318ac25dfdc
equal deleted inserted replaced
49567:04e6add9e4dc 49568:05ef5f097df4
   299             };
   299             };
   300             config_val.or(Some(get_path_from_bytes(&repo_arg).to_path_buf()))
   300             config_val.or(Some(get_path_from_bytes(&repo_arg).to_path_buf()))
   301         }
   301         }
   302     };
   302     };
   303 
   303 
   304     let exit =
   304     let simple_exit =
   305         |ui: &Ui, config: &Config, result: Result<(), CommandError>| -> ! {
   305         |ui: &Ui, config: &Config, result: Result<(), CommandError>| -> ! {
   306             exit(
   306             exit(
   307                 &argv,
   307                 &argv,
   308                 &initial_current_dir,
   308                 &initial_current_dir,
   309                 ui,
   309                 ui,
   315                     .get_bool(b"ui", b"detailed-exit-code")
   315                     .get_bool(b"ui", b"detailed-exit-code")
   316                     .unwrap_or(false),
   316                     .unwrap_or(false),
   317             )
   317             )
   318         };
   318         };
   319     let early_exit = |config: &Config, error: CommandError| -> ! {
   319     let early_exit = |config: &Config, error: CommandError| -> ! {
   320         exit(&Ui::new_infallible(config), &config, Err(error))
   320         simple_exit(&Ui::new_infallible(config), &config, Err(error))
   321     };
   321     };
   322     let repo_result = match Repo::find(&non_repo_config, repo_path.to_owned())
   322     let repo_result = match Repo::find(&non_repo_config, repo_path.to_owned())
   323     {
   323     {
   324         Ok(repo) => Ok(repo),
   324         Ok(repo) => Ok(repo),
   325         Err(RepoError::NotFound { at }) if repo_path.is_none() => {
   325         Err(RepoError::NotFound { at }) if repo_path.is_none() => {
   353         &process_start_time,
   353         &process_start_time,
   354         &ui,
   354         &ui,
   355         repo_result.as_ref(),
   355         repo_result.as_ref(),
   356         config,
   356         config,
   357     );
   357     );
   358     exit(&ui, &config, result)
   358     simple_exit(&ui, &config, result)
   359 }
   359 }
   360 
   360 
   361 fn main() -> ! {
   361 fn main() -> ! {
   362     rhg_main(std::env::args_os().collect())
   362     rhg_main(std::env::args_os().collect())
   363 }
   363 }