Skip to content

Commit aac0d34

Browse files
committed
prepare for optional addition of line renderer for lean version
1 parent af02b46 commit aac0d34

File tree

5 files changed

+61
-4
lines changed

5 files changed

+61
-4
lines changed

Diff for: Cargo.lock

+41-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ pretty-cli = ["structopt",
4040
"smol"]
4141
lean-cli = ["argh", "git-features/progress-log", "env_logger"]
4242

43+
prodash-line-renderer-crossterm = ["prodash/line-renderer", "prodash/line-renderer-crossterm"]
44+
prodash-line-renderer-termion = ["prodash/line-renderer", "prodash/line-renderer-termion"]
45+
4346
[dependencies]
4447
anyhow = "1.0.31"
4548

Diff for: README.md

+3
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ The top-level command-line interface.
174174
* **lean-cli** _(mutually exclusive to pretty-cli)_
175175
* Use `argh` to produce a usable binary with decent documentation that is smallest in size, usually 300kb less than `pretty-cli`.
176176
* If `pretty-cli` is enabled as well, `small-cli` will take precedence, and you pay for building unnecessary dependencies.
177+
* **prodash-line-renderer-crossterm** or **prodash-line-renderer-termion** _(mutually exclusive)_
178+
* The `--verbose` flag will be powered by an interactive progress mechanism that doubles as log as well as interactive progress
179+
that appears after a short duration.
177180

178181
There are convenience features, which combine common choices of the above into one name
179182

Diff for: src/plumbing-cli.rs

+3
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ fn main() -> Result<()> {
1515
fn main() -> Result<()> {
1616
plumbing::lean::main()
1717
}
18+
19+
#[cfg(not(any(feature = "pretty-cli", feature = "lean-cli")))]
20+
compile_error!("Please set 'lean-cli' or 'pretty-cli' feature flags");

Diff for: src/plumbing/lean.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ use git_features::progress;
4141
use gitoxide_core as core;
4242
use std::io::{stderr, stdout};
4343

44+
#[cfg(not(any(
45+
feature = "prodash-line-renderer-crossterm",
46+
feature = "prodash-line-renderer-termion"
47+
)))]
48+
fn prepare(verbose: bool, name: &str) -> ((), progress::Log) {
49+
super::init_env_logger(verbose);
50+
((), progress::Log::new(name, Some(1)))
51+
}
52+
4453
pub fn main() -> Result<()> {
4554
pub use options::*;
4655
let cli: Args = crate::shared::from_env();
@@ -50,10 +59,10 @@ pub fn main() -> Result<()> {
5059
verbose,
5160
statistics,
5261
}) => {
53-
super::init_env_logger(verbose);
62+
let (_handle, progress) = prepare(verbose, "verify-pack");
5463
core::verify_pack_or_pack_index(
5564
path,
56-
progress::Log::new("verify-pack", Some(1)).into(),
65+
progress.into(),
5766
if statistics {
5867
Some(core::OutputFormat::Human)
5968
} else {

0 commit comments

Comments
 (0)