Skip to content

Commit

Permalink
prepare for optional addition of line renderer for lean version
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Jul 10, 2020
1 parent af02b46 commit aac0d34
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 4 deletions.
43 changes: 41 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ pretty-cli = ["structopt",
"smol"]
lean-cli = ["argh", "git-features/progress-log", "env_logger"]

prodash-line-renderer-crossterm = ["prodash/line-renderer", "prodash/line-renderer-crossterm"]
prodash-line-renderer-termion = ["prodash/line-renderer", "prodash/line-renderer-termion"]

[dependencies]
anyhow = "1.0.31"

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ The top-level command-line interface.
* **lean-cli** _(mutually exclusive to pretty-cli)_
* Use `argh` to produce a usable binary with decent documentation that is smallest in size, usually 300kb less than `pretty-cli`.
* If `pretty-cli` is enabled as well, `small-cli` will take precedence, and you pay for building unnecessary dependencies.
* **prodash-line-renderer-crossterm** or **prodash-line-renderer-termion** _(mutually exclusive)_
* The `--verbose` flag will be powered by an interactive progress mechanism that doubles as log as well as interactive progress
that appears after a short duration.

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

Expand Down
3 changes: 3 additions & 0 deletions src/plumbing-cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ fn main() -> Result<()> {
fn main() -> Result<()> {
plumbing::lean::main()
}

#[cfg(not(any(feature = "pretty-cli", feature = "lean-cli")))]
compile_error!("Please set 'lean-cli' or 'pretty-cli' feature flags");
13 changes: 11 additions & 2 deletions src/plumbing/lean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ use git_features::progress;
use gitoxide_core as core;
use std::io::{stderr, stdout};

#[cfg(not(any(
feature = "prodash-line-renderer-crossterm",
feature = "prodash-line-renderer-termion"
)))]
fn prepare(verbose: bool, name: &str) -> ((), progress::Log) {
super::init_env_logger(verbose);
((), progress::Log::new(name, Some(1)))
}

pub fn main() -> Result<()> {
pub use options::*;
let cli: Args = crate::shared::from_env();
Expand All @@ -50,10 +59,10 @@ pub fn main() -> Result<()> {
verbose,
statistics,
}) => {
super::init_env_logger(verbose);
let (_handle, progress) = prepare(verbose, "verify-pack");
core::verify_pack_or_pack_index(
path,
progress::Log::new("verify-pack", Some(1)).into(),
progress.into(),
if statistics {
Some(core::OutputFormat::Human)
} else {
Expand Down

0 comments on commit aac0d34

Please sign in to comment.