Skip to content

Commit 652a0ac

Browse files
committed
small build now uses the line renderer as well
With the latest changes there is no use in using the greatly inferior log renderer anymore. Instead, we should go for more options to configure the line renderer and make it leaner, for example.
1 parent 4f8dd56 commit 652a0ac

File tree

2 files changed

+12
-31
lines changed

2 files changed

+12
-31
lines changed

Diff for: Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fast = ["git-features/parallel", "git-features/fast-sha1", "git-features/zlib-ng
3535
## Use `clap` 3.0 to build the prettiest, best documented and most user-friendly CLI at the expense of binary size.
3636
## Provides a terminal user interface for detailed and exhaustive progress.
3737
## Provides a line renderer for leaner progress display, without the need for a full-blown TUI.
38-
pretty-cli = [ "gitoxide-core/serde1", "prodash/progress-tree", "prodash/progress-tree-log", "prodash/local-time", "gitoxide-core/local-time-support", "env_logger" ]
38+
pretty-cli = [ "gitoxide-core/serde1", "prodash/progress-tree", "prodash/progress-tree-log", "prodash/local-time", "gitoxide-core/local-time-support", "env_logger/humantime", "env_logger/termcolor", "env_logger/atty" ]
3939

4040
## The `--verbose` flag will be powered by an interactive progress mechanism that doubles as log as well as interactive progress
4141
## that appears after a short duration.
@@ -57,7 +57,7 @@ lean-async = ["fast", "pretty-cli", "gitoxide-core-tools", "gitoxide-core-async-
5757

5858
## As small as it can possibly be, no threading, no fast sha1, log based progress only, rust based zlib implementation.
5959
## no networking, local operations only.
60-
small = ["pretty-cli", "git-features/rustsha1", "git-features/zlib-rust-backend", "prodash/progress-log", "atty", "env_logger"]
60+
small = ["pretty-cli", "git-features/rustsha1", "git-features/zlib-rust-backend", "prodash-render-line", "atty" ]
6161

6262
#! ### `gitoxide-core` Configuration
6363

@@ -91,7 +91,7 @@ git-transport-for-configuration-only = { package = "git-transport", optional = t
9191
clap = { version = "3.0.0", features = ["derive", "cargo"] }
9292
prodash = { version = "19.0.0", optional = true, default-features = false }
9393
atty = { version = "0.2.14", optional = true, default-features = false }
94-
env_logger = { version = "0.9.0", optional = true, default-features = false, features = ["humantime", "termcolor", "atty"] }
94+
env_logger = { version = "0.9.0", default-features = false }
9595
crosstermion = { version = "0.9.0", optional = true, default-features = false }
9696
futures-lite = { version = "1.12.0", optional = true, default-features = false, features = ["std"] }
9797

Diff for: src/shared.rs

+9-28
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pub const STANDARD_RANGE: ProgressRange = 2..=2;
88

99
/// If verbose is true, the env logger will be forcibly set to 'info' logging level. Otherwise env logging facilities
1010
/// will just be initialized.
11-
#[cfg(feature = "env_logger")]
1211
#[allow(unused)] // Squelch warning because it's used in porcelain as well and we can't know that at compile time
1312
pub fn init_env_logger() {
1413
if cfg!(feature = "small") {
@@ -59,13 +58,7 @@ pub mod pretty {
5958
progress: bool,
6059
#[cfg_attr(not(feature = "prodash-render-tui"), allow(unused_variables))] progress_keep_open: bool,
6160
#[cfg_attr(not(feature = "prodash-render-line"), allow(unused_variables))] range: impl Into<Option<ProgressRange>>,
62-
#[cfg(not(any(feature = "prodash-render-line", feature = "prodash-render-tui")))] run: impl FnOnce(
63-
progress::DoOrDiscard<prodash::progress::Log>,
64-
&mut dyn std::io::Write,
65-
&mut dyn std::io::Write,
66-
)
67-
-> Result<T>,
68-
#[cfg(any(feature = "prodash-render-line", feature = "prodash-render-tui"))] run: impl FnOnce(
61+
run: impl FnOnce(
6962
progress::DoOrDiscard<prodash::tree::Item>,
7063
&mut dyn std::io::Write,
7164
&mut dyn std::io::Write,
@@ -87,27 +80,15 @@ pub mod pretty {
8780
(true, false) => {
8881
let progress = crate::shared::progress_tree();
8982
let sub_progress = progress.add_child(name);
90-
#[cfg(not(feature = "prodash-render-line"))]
91-
{
92-
let stdout = stdout();
93-
let mut stdout_lock = stdout.lock();
94-
run(
95-
progress::DoOrDiscard::from(Some(sub_progress)),
96-
&mut stdout_lock,
97-
&mut stderr(),
98-
)
99-
}
100-
#[cfg(feature = "prodash-render-line")]
101-
{
102-
use crate::shared::{self, STANDARD_RANGE};
103-
let handle = shared::setup_line_renderer_range(&progress, range.into().unwrap_or(STANDARD_RANGE));
10483

105-
let mut out = Vec::<u8>::new();
106-
let res = run(progress::DoOrDiscard::from(Some(sub_progress)), &mut out, &mut stderr());
107-
handle.shutdown_and_wait();
108-
std::io::Write::write_all(&mut stdout(), &out)?;
109-
res
110-
}
84+
use crate::shared::{self, STANDARD_RANGE};
85+
let handle = shared::setup_line_renderer_range(&progress, range.into().unwrap_or(STANDARD_RANGE));
86+
87+
let mut out = Vec::<u8>::new();
88+
let res = run(progress::DoOrDiscard::from(Some(sub_progress)), &mut out, &mut stderr());
89+
handle.shutdown_and_wait();
90+
std::io::Write::write_all(&mut stdout(), &out)?;
91+
res
11192
}
11293
#[cfg(not(feature = "prodash-render-tui"))]
11394
(true, true) | (false, true) => {

0 commit comments

Comments
 (0)