Improve CLI streaming output, logging flags, and schema/help ergonomics

This commit is contained in:
Gregory Schier
2026-02-23 08:01:30 -08:00
parent 35d9ed901a
commit 64c626ed30
8 changed files with 69 additions and 30 deletions

View File

@@ -21,10 +21,14 @@ pub struct Cli {
#[arg(long, short, global = true)]
pub environment: Option<String>,
/// Enable verbose logging
/// Enable verbose send output (events and streamed response body)
#[arg(long, short, global = true)]
pub verbose: bool,
/// Enable CLI logging; optionally set level (error|warn|info|debug|trace)
#[arg(long, global = true, value_name = "LEVEL", num_args = 0..=1, ignore_case = true)]
pub log: Option<Option<LogLevel>>,
#[command(subcommand)]
pub command: Commands,
}
@@ -227,6 +231,27 @@ pub enum RequestSchemaType {
Websocket,
}
#[derive(Clone, Copy, Debug, ValueEnum)]
pub enum LogLevel {
Error,
Warn,
Info,
Debug,
Trace,
}
impl LogLevel {
pub fn as_filter(self) -> log::LevelFilter {
match self {
LogLevel::Error => log::LevelFilter::Error,
LogLevel::Warn => log::LevelFilter::Warn,
LogLevel::Info => log::LevelFilter::Info,
LogLevel::Debug => log::LevelFilter::Debug,
LogLevel::Trace => log::LevelFilter::Trace,
}
}
}
#[derive(Args)]
#[command(disable_help_subcommand = true)]
pub struct FolderArgs {