Skip to content

Commit

Permalink
unify frame rate across plumbing (and later potentially porcelain)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Jul 11, 2020
1 parent 41e01a5 commit e2a7bdd
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ pretty-cli = ["structopt",
"git-features/progress-log",
"gitoxide-core/serde1",
"prodash/log-renderer",
"prodash/tui-renderer",
"prodash-tui-renderer",
"prodash/localtime",
"env_logger",
"smol"]
lean-cli = ["argh", "git-features/progress-log", "env_logger"]

prodash-line-renderer-crossterm = ["prodash/line-renderer", "prodash/line-renderer-crossterm", "git-features/progress-prodash", "atty", "crosstermion"]
prodash-line-renderer-termion = ["prodash/line-renderer", "prodash/line-renderer-termion", "git-features/progress-prodash", "atty", "crosstermion"]
prodash-tui-renderer = ["prodash/tui-renderer"]
prodash-line-renderer = ["prodash/line-renderer"]
prodash-line-renderer-crossterm = ["prodash-line-renderer", "prodash/line-renderer-crossterm", "git-features/progress-prodash", "atty", "crosstermion"]
prodash-line-renderer-termion = ["prodash-line-renderer", "prodash/line-renderer-termion", "git-features/progress-prodash", "atty", "crosstermion"]

[dependencies]
anyhow = "1.0.31"
Expand Down
1 change: 0 additions & 1 deletion src/plumbing-cli.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![forbid(unsafe_code)]

mod plumbing;
#[cfg(feature = "lean-cli")]
mod shared;

use anyhow::Result;
Expand Down
2 changes: 1 addition & 1 deletion src/plumbing/lean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn prepare(verbose: bool, name: &str) -> (Option<prodash::line::JoinHandle>, Opt
progress,
prodash::line::Options {
level_filter: Some(std::ops::RangeInclusive::new(2, 2)),
frames_per_second: 6.0,
frames_per_second: crate::shared::DEFAULT_FRAME_RATE,
initial_delay: Some(std::time::Duration::from_millis(1000)),
output_is_terminal,
colored: output_is_terminal && crosstermion::color::allowed(),
Expand Down
2 changes: 1 addition & 1 deletion src/plumbing/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fn init_progress(
progress,
prodash::tui::Options {
title: "gitoxide".into(),
frames_per_second: 6.0,
frames_per_second: crate::shared::DEFAULT_FRAME_RATE,
stop_if_empty_progress: !progress_keep_open,
..Default::default()
},
Expand Down
1 change: 0 additions & 1 deletion src/porcelain-cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

mod porcelain;

#[cfg(feature = "lean-cli")]
mod shared;

use anyhow::Result;
Expand Down
5 changes: 4 additions & 1 deletion src/shared.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
static VERSION: &str = concat!(env!("CARGO_PKG_NAME"), " ", env!("CARGO_PKG_VERSION"));
#[cfg(any(feature = "prodash-line-renderer", feature = "prodash-tui-renderer"))]
pub const DEFAULT_FRAME_RATE: f32 = 6.0;

#[cfg(all(feature = "lean-cli", not(feature = "pretty-cli")))]
pub fn from_env<T: argh::TopLevelCommand>() -> T {
static VERSION: &str = concat!(env!("CARGO_PKG_NAME"), " ", env!("CARGO_PKG_VERSION"));
let strings: Vec<String> = std::env::args().collect();
let strs: Vec<&str> = strings.iter().map(|s| s.as_str()).collect();
T::from_args(&[strs[0]], &strs[1..]).unwrap_or_else(|early_exit| {
Expand Down

0 comments on commit e2a7bdd

Please sign in to comment.