[refactor] propagate no-progress and no-interaction flags, enhance prompt handling, and update progress bar logic with cliclack

This commit is contained in:
2025-08-14 10:34:52 +02:00
parent 9841550dcc
commit 0573369b81
7 changed files with 207 additions and 43 deletions

View File

@@ -3,6 +3,10 @@ name = "polyscribe-cli"
version = "0.1.0"
edition = "2024"
[[bin]]
name = "polyscribe"
path = "src/main.rs"
[dependencies]
anyhow = "1.0.99"
clap = { version = "4.5.44", features = ["derive"] }
@@ -23,3 +27,6 @@ polyscribe-protocol = { path = "../polyscribe-protocol" }
[features]
# Optional GPU-specific flags can be forwarded down to core/host if needed
default = []
[dev-dependencies]
assert_cmd = "2.0.16"

View File

@@ -25,6 +25,10 @@ pub struct Cli {
#[arg(long, default_value_t = false)]
pub no_interaction: bool,
/// Disable progress bars/spinners
#[arg(long, default_value_t = false)]
pub no_progress: bool,
#[command(subcommand)]
pub command: Commands,
}

View File

@@ -35,10 +35,11 @@ async fn main() -> Result<()> {
init_tracing(args.quiet, args.verbose);
// Optionally propagate quiet/no-interaction/verbosity to core if your lib exposes setters.
// polyscribe_core::set_quiet(args.quiet);
// polyscribe_core::set_no_interaction(args.no_interaction);
// polyscribe_core::set_verbose(args.verbose);
// Propagate UI flags to core so ui facade can apply policy
polyscribe_core::set_quiet(args.quiet);
polyscribe_core::set_no_interaction(args.no_interaction);
polyscribe_core::set_verbose(args.verbose);
polyscribe_core::set_no_progress(args.no_progress);
let _cfg = ConfigService::load_or_default().context("loading configuration")?;

View File

@@ -2,11 +2,9 @@
// Copyright (c) 2025 <COPYRIGHT HOLDER>. All rights reserved.
use std::process::Command;
use assert_cmd::cargo::cargo_bin;
fn bin() -> String {
std::env::var("CARGO_BIN_EXE_polyscribe")
.unwrap_or_else(|_| "polyscribe".to_string())
}
fn bin() -> std::path::PathBuf { cargo_bin("polyscribe") }
#[test]
fn aux_completions_bash_outputs_script() {