mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-09 03:20:56 +00:00
Add FABRO_* environment variables for global CLI args
Enable clap's `env` feature and wire each global flag to a corresponding environment variable (FABRO_DEBUG, FABRO_QUIET, FABRO_VERBOSE, FABRO_NO_UPGRADE_CHECK, FABRO_STORAGE_DIR, FABRO_SERVER_URL). Boolean flags use BoolishValueParser so they accept 1/true/yes/on and their inverses. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
814c798cec
commit
dfc30b6d3a
2 changed files with 12 additions and 7 deletions
|
|
@ -25,7 +25,7 @@ async-trait = "0.1"
|
|||
base64 = "0.22"
|
||||
bytes = "1"
|
||||
tokio-util = "0.7"
|
||||
clap = { version = "4", features = ["derive"] }
|
||||
clap = { version = "4", features = ["derive", "env"] }
|
||||
jsonschema = { version = "0.42", default-features = false }
|
||||
chrono = { version = "0.4", features = ["clock"] }
|
||||
bollard = "0.18"
|
||||
|
|
|
|||
|
|
@ -18,28 +18,33 @@ pub(crate) const LONG_VERSION: &str = concat!(
|
|||
#[derive(Args)]
|
||||
pub(crate) struct GlobalArgs {
|
||||
/// Enable DEBUG-level logging (default is INFO)
|
||||
#[arg(long, global = true)]
|
||||
#[arg(long, global = true, env = "FABRO_DEBUG", value_parser = clap::builder::BoolishValueParser::new())]
|
||||
pub debug: bool,
|
||||
|
||||
/// Disable automatic upgrade check
|
||||
#[arg(long, global = true)]
|
||||
#[arg(long, global = true, env = "FABRO_NO_UPGRADE_CHECK", value_parser = clap::builder::BoolishValueParser::new())]
|
||||
pub no_upgrade_check: bool,
|
||||
|
||||
/// Suppress non-essential output
|
||||
#[arg(long, global = true, conflicts_with = "verbose")]
|
||||
#[arg(long, global = true, env = "FABRO_QUIET", value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "verbose")]
|
||||
pub quiet: bool,
|
||||
|
||||
/// Enable verbose output
|
||||
#[arg(long, global = true, conflicts_with = "quiet")]
|
||||
#[arg(long, global = true, env = "FABRO_VERBOSE", value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "quiet")]
|
||||
pub verbose: bool,
|
||||
|
||||
/// Storage directory (default: ~/.fabro)
|
||||
#[arg(long, global = true)]
|
||||
#[arg(long, global = true, env = "FABRO_STORAGE_DIR")]
|
||||
pub storage_dir: Option<PathBuf>,
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
/// Server URL (overrides server.base_url from cli.toml)
|
||||
#[arg(long, global = true, conflicts_with = "storage_dir")]
|
||||
#[arg(
|
||||
long,
|
||||
global = true,
|
||||
env = "FABRO_SERVER_URL",
|
||||
conflicts_with = "storage_dir"
|
||||
)]
|
||||
pub server_url: Option<String>,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue