pub struct GlobalArgs {
pub api_key: Option<String>,
pub config_file: Option<PathBuf>,
pub format: Option<Format>,
pub wide: bool,
pub no_color: bool,
pub quiet: bool,
pub verbose: bool,
pub no_input: bool,
pub yes_count: u8,
pub retries: u32,
pub base_url: Option<String>,
}Expand description
Top-level flags inherited by every subcommand.
Fields§
§api_key: Option<String>§config_file: Option<PathBuf>--config-file: alternate config TOML. None means the default path
(~/.config/qn/config.toml).
format: Option<Format>None means the user didn’t pass --format; resolve via config file
(then the TTY-aware default: Table on a TTY, Json off) when we
build the Ctx.
wide: bool§no_color: bool§quiet: bool§verbose: bool§no_input: bool§yes_count: u8§retries: u32Max automatic retries for read-only API calls (see crate::retry).
Default yields 0 (no retries) — the CLI default of 3 comes from clap.
base_url: Option<String>Implementations§
Source§impl GlobalArgs
impl GlobalArgs
Sourcepub fn resolve_format(&self, stdout_is_tty: bool) -> Format
pub fn resolve_format(&self, stdout_is_tty: bool) -> Format
Resolve the output format: CLI flag > config file > TTY-aware default
(Table on a TTY, Json off).
Used by Ctx::from_global and auth (which doesn’t build a Ctx).
Sourcepub fn resolve_output(&self, stdout_is_tty: bool) -> (Format, bool)
pub fn resolve_output(&self, stdout_is_tty: bool) -> (Format, bool)
Resolve (format, wide) together so we only read the config file once.
For each: CLI flag > config file > built-in default. The format default
is TTY-aware: Table when stdout is a terminal, Json otherwise (so
agents / piped callers get a structured format by default). --wide is
purely additive — the flag sets it true; the config file can also set
it true; otherwise it’s false.
Sourcepub fn resolve_config_path(&self) -> Option<PathBuf>
pub fn resolve_config_path(&self) -> Option<PathBuf>
The config file to read: --config-file if given, else the default path.
Trait Implementations§
Source§impl Clone for GlobalArgs
impl Clone for GlobalArgs
Source§fn clone(&self) -> GlobalArgs
fn clone(&self) -> GlobalArgs
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more