Skip to content

Commit 96e3a55

Browse files
committed
move is_git_installed in cli_utils.rs
1 parent 1fecaea commit 96e3a55

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

Diff for: src/main.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@
44

55
use onefetch::{cli::Cli, cli_utils, error::*, info, repo};
66

7-
use {
8-
process::{Command, Stdio},
9-
std::{io, process},
10-
};
7+
use std::{io, process};
118

129
mod onefetch;
1310

1411
fn run() -> Result<()> {
1512
#[cfg(windows)]
1613
let _ = ansi_term::enable_ansi_support();
1714

18-
if !is_git_installed() {
15+
if !cli_utils::is_git_installed() {
1916
return Err("git failed to execute!".into());
2017
}
2118

@@ -55,7 +52,3 @@ fn main() {
5552
}
5653
}
5754
}
58-
59-
fn is_git_installed() -> bool {
60-
Command::new("git").arg("--version").stdout(Stdio::null()).status().is_ok()
61-
}

Diff for: src/onefetch/cli_utils.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::onefetch::{
55
use colored::Color;
66
use std::env;
77
use std::io::Write;
8-
use std::process::Command;
8+
use std::process::{Command, Stdio};
99
use strum::IntoEnumIterator;
1010

1111
pub struct Printer<W> {
@@ -112,3 +112,7 @@ pub fn get_git_version() -> Result<String> {
112112
let version = Command::new("git").arg("--version").output()?;
113113
Ok(String::from_utf8_lossy(&version.stdout).replace('\n', ""))
114114
}
115+
116+
pub fn is_git_installed() -> bool {
117+
Command::new("git").arg("--version").stdout(Stdio::null()).status().is_ok()
118+
}

0 commit comments

Comments
 (0)