move check for valid Git repo further down
@@ -12,16 +12,8 @@ fn run() -> Result<()> {
#[cfg(windows)]
let _ = ansi_term::enable_ansi_support();
- if !cli_utils::is_git_installed() {
- return Err("git failed to execute!".into());
- }
-
let config = Cli::new()?;
- if !repo::is_valid(&config.repo_path)? {
- return Err("please run onefetch inside of a non-bare git repository".into());
- }
-
if config.print_languages {
return cli_utils::print_supported_languages();
}
@@ -30,6 +22,14 @@ fn run() -> Result<()> {
return cli_utils::print_supported_package_managers();
}
+ if !cli_utils::is_git_installed() {
+ return Err("git failed to execute!".into());
+ }
+
+ if !repo::is_valid(&config.repo_path)? {
+ return Err("please run onefetch inside of a non-bare git repository".into());
+ }
+
let info = info::Info::new(config)?;
let mut printer = Printer::new(io::BufWriter::new(io::stdout()), info);
