mirror of
https://github.com/Hopiu/lychee.git
synced 2026-04-30 09:54:46 +00:00
Show progress bar by default (can be disabled with --no-progress)
This commit is contained in:
parent
09ceda5931
commit
2272ad1a48
4 changed files with 16 additions and 11 deletions
|
|
@ -163,7 +163,8 @@ FLAGS:
|
|||
--glob-ignore-case Ignore case when expanding filesystem path glob inputs
|
||||
--help Prints help information
|
||||
-i, --insecure Proceed for server connections considered insecure (invalid TLS)
|
||||
-p, --progress Show progress
|
||||
-n, --no-progress Do not show progress bar. This is recommended for non-interactive shells (e.g. for
|
||||
continuos integration)
|
||||
--skip-missing Skip missing input files (default is to error if they don't exist)
|
||||
-V, --version Prints version information
|
||||
-v, --verbose Verbose program output
|
||||
|
|
|
|||
|
|
@ -140,15 +140,16 @@ async fn run(cfg: &Config, inputs: Vec<Input>) -> Result<i32> {
|
|||
)
|
||||
.await?;
|
||||
|
||||
let pb = if cfg.progress {
|
||||
let bar =
|
||||
ProgressBar::new(links.len() as u64).with_style(ProgressStyle::default_bar().template(
|
||||
let pb = match cfg.no_progress {
|
||||
true => None,
|
||||
false => {
|
||||
let bar = ProgressBar::new(links.len() as u64)
|
||||
.with_style(ProgressStyle::default_bar().template(
|
||||
"{spinner:.red.bright} {pos}/{len:.dim} [{elapsed_precise}] {bar:25} {wide_msg}",
|
||||
));
|
||||
bar.enable_steady_tick(100);
|
||||
Some(bar)
|
||||
} else {
|
||||
None
|
||||
bar.enable_steady_tick(100);
|
||||
Some(bar)
|
||||
}
|
||||
};
|
||||
|
||||
let (send_req, recv_req) = mpsc::channel(max_concurrency);
|
||||
|
|
|
|||
|
|
@ -116,10 +116,12 @@ pub struct Config {
|
|||
#[serde(default)]
|
||||
pub verbose: bool,
|
||||
|
||||
/// Show progress
|
||||
/// Do not show progress bar.
|
||||
/// This is recommended for non-interactive shells (e.g. for continuos
|
||||
/// integration)
|
||||
#[structopt(short, long)]
|
||||
#[serde(default)]
|
||||
pub progress: bool,
|
||||
pub no_progress: bool,
|
||||
|
||||
/// Maximum number of allowed redirects
|
||||
#[structopt(short, long, default_value = &MAX_REDIRECTS_STR)]
|
||||
|
|
@ -273,7 +275,7 @@ impl Config {
|
|||
|
||||
// Keys with defaults to assign
|
||||
verbose: false;
|
||||
progress: false;
|
||||
no_progress: false;
|
||||
max_redirects: MAX_REDIRECTS;
|
||||
max_concurrency: MAX_CONCURRENCY;
|
||||
threads: None;
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ mod cli {
|
|||
let test_github_404_path = fixtures_path().join("TEST_GITHUB_404.md");
|
||||
|
||||
cmd.arg(test_github_404_path)
|
||||
.arg("--no-progress")
|
||||
.env_clear()
|
||||
.assert()
|
||||
.failure()
|
||||
|
|
|
|||
Loading…
Reference in a new issue