add colors
This commit is contained in:
parent
5802b1104c
commit
bafbb58ff0
3 changed files with 38 additions and 2 deletions
32
Cargo.lock
generated
32
Cargo.lock
generated
|
@ -2,6 +2,15 @@
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ansi_term"
|
||||||
|
version = "0.12.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstream"
|
name = "anstream"
|
||||||
version = "0.6.13"
|
version = "0.6.13"
|
||||||
|
@ -108,6 +117,7 @@ dependencies = [
|
||||||
name = "giterator"
|
name = "giterator"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"ansi_term",
|
||||||
"clap",
|
"clap",
|
||||||
"csv",
|
"csv",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
@ -209,6 +219,28 @@ version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi"
|
||||||
|
version = "0.3.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||||
|
dependencies = [
|
||||||
|
"winapi-i686-pc-windows-gnu",
|
||||||
|
"winapi-x86_64-pc-windows-gnu",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-i686-pc-windows-gnu"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-x86_64-pc-windows-gnu"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
version = "0.52.0"
|
version = "0.52.0"
|
||||||
|
|
|
@ -6,6 +6,7 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
ansi_term = "0.12.1"
|
||||||
clap = { version = "4.5.2", features = ["cargo"] }
|
clap = { version = "4.5.2", features = ["cargo"] }
|
||||||
csv = "1.3.0"
|
csv = "1.3.0"
|
||||||
serde_json = "1.0.114"
|
serde_json = "1.0.114"
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
use std::process::{Command, Output};
|
use std::process::{Command, Output};
|
||||||
|
|
||||||
|
use ansi_term::Color;
|
||||||
mod args;
|
mod args;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -27,7 +29,9 @@ impl IterationOutput {
|
||||||
fn print_text(&self) {
|
fn print_text(&self) {
|
||||||
println!(
|
println!(
|
||||||
"Commit [{}] ({}): {}",
|
"Commit [{}] ({}): {}",
|
||||||
self.commit.hash, self.commit.datetime, self.commit.name
|
Color::Green.paint(&self.commit.hash),
|
||||||
|
Color::Purple.paint(&self.commit.datetime),
|
||||||
|
Color::Blue.paint(&self.commit.name)
|
||||||
);
|
);
|
||||||
println!("{}", self.stdout);
|
println!("{}", self.stdout);
|
||||||
if !self.stderr.is_empty() {
|
if !self.stderr.is_empty() {
|
||||||
|
@ -169,7 +173,6 @@ fn main() {
|
||||||
if is_repository_clean(repo) || allow_dirty {
|
if is_repository_clean(repo) || allow_dirty {
|
||||||
let commits = get_commit_list(repo).unwrap();
|
let commits = get_commit_list(repo).unwrap();
|
||||||
for commit in commits {
|
for commit in commits {
|
||||||
// todo : add colors
|
|
||||||
out.push(commit.run_command(&command));
|
out.push(commit.run_command(&command));
|
||||||
}
|
}
|
||||||
checkout(repo, "main").unwrap();
|
checkout(repo, "main").unwrap();
|
||||||
|
|
Loading…
Add table
Reference in a new issue