From 0cc1bf25c69611f9512fec415ae8e09b608706fc Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 10 Jul 2020 16:53:26 +0800 Subject: [PATCH] =?UTF-8?q?first=20very=20basic=20version=20of=20line=20re?= =?UTF-8?q?nderer=20progress=20-=20works=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …but there are maby low hanging improvements to be made. --- Cargo.toml | 2 +- src/plumbing/lean.rs | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 79ee0db8f70..c80b1aeace2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ doctest = false [features] default = ["max"] max = ["fast", "pretty-cli"] -lean = ["fast", "lean-cli"] +lean = ["fast", "lean-cli", "prodash-line-renderer-crossterm", "git-features/progress-prodash"] small = ["lean-cli"] fast = ["git-features/parallel", "git-features/fast-sha1"] diff --git a/src/plumbing/lean.rs b/src/plumbing/lean.rs index 91e262dd975..b132798897f 100644 --- a/src/plumbing/lean.rs +++ b/src/plumbing/lean.rs @@ -50,6 +50,22 @@ fn prepare(verbose: bool, name: &str) -> ((), progress::Log) { ((), progress::Log::new(name, Some(1))) } +#[cfg(any( + feature = "prodash-line-renderer-crossterm", + feature = "prodash-line-renderer-termion" +))] +fn prepare(verbose: bool, name: &str) -> (prodash::line::JoinHandle, progress::DoOrDiscard) { + super::init_env_logger(false); + + let progress = prodash::Tree::new(); + let sub_progress = progress.add_child(name); + let handle = prodash::line::render(stderr(), progress, prodash::line::Options::default()); + ( + handle, + progress::DoOrDiscard::from(if verbose { Some(sub_progress) } else { None }), + ) +} + pub fn main() -> Result<()> { pub use options::*; let cli: Args = crate::shared::from_env();