treewide: fix various UI bugs; optimize crypto dependencies & format
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: If8fe8b38c1d9c4fecd40ff71f88d2ae06a6a6964
This commit is contained in:
parent
764aafa88d
commit
3ccddce7fd
178 changed files with 58285 additions and 54241 deletions
|
|
@ -12,44 +12,46 @@ mod ui;
|
|||
#[derive(Parser)]
|
||||
#[command(name = "pinakes-tui", version, about)]
|
||||
struct Cli {
|
||||
/// Server URL to connect to
|
||||
#[arg(
|
||||
short,
|
||||
long,
|
||||
env = "PINAKES_SERVER_URL",
|
||||
default_value = "http://localhost:3000"
|
||||
)]
|
||||
server: String,
|
||||
/// Server URL to connect to
|
||||
#[arg(
|
||||
short,
|
||||
long,
|
||||
env = "PINAKES_SERVER_URL",
|
||||
default_value = "http://localhost:3000"
|
||||
)]
|
||||
server: String,
|
||||
|
||||
/// Set log level (trace, debug, info, warn, error)
|
||||
#[arg(long, default_value = "warn")]
|
||||
log_level: String,
|
||||
/// Set log level (trace, debug, info, warn, error)
|
||||
#[arg(long, default_value = "warn")]
|
||||
log_level: String,
|
||||
|
||||
/// Log to file instead of stderr (avoids corrupting TUI display)
|
||||
#[arg(long)]
|
||||
log_file: Option<std::path::PathBuf>,
|
||||
/// Log to file instead of stderr (avoids corrupting TUI display)
|
||||
#[arg(long)]
|
||||
log_file: Option<std::path::PathBuf>,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
let cli = Cli::parse();
|
||||
let cli = Cli::parse();
|
||||
|
||||
// Initialize logging - for TUI, must log to file to avoid corrupting the display
|
||||
let env_filter = EnvFilter::try_new(&cli.log_level).unwrap_or_else(|_| EnvFilter::new("warn"));
|
||||
// Initialize logging - for TUI, must log to file to avoid corrupting the
|
||||
// display
|
||||
let env_filter = EnvFilter::try_new(&cli.log_level)
|
||||
.unwrap_or_else(|_| EnvFilter::new("warn"));
|
||||
|
||||
if let Some(log_path) = &cli.log_file {
|
||||
let file = std::fs::File::create(log_path)?;
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(env_filter)
|
||||
.with_writer(file)
|
||||
.with_ansi(false)
|
||||
.init();
|
||||
} else {
|
||||
// When no log file specified, suppress all output to avoid TUI corruption
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(EnvFilter::new("off"))
|
||||
.init();
|
||||
}
|
||||
if let Some(log_path) = &cli.log_file {
|
||||
let file = std::fs::File::create(log_path)?;
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(env_filter)
|
||||
.with_writer(file)
|
||||
.with_ansi(false)
|
||||
.init();
|
||||
} else {
|
||||
// When no log file specified, suppress all output to avoid TUI corruption
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(EnvFilter::new("off"))
|
||||
.init();
|
||||
}
|
||||
|
||||
app::run(&cli.server).await
|
||||
app::run(&cli.server).await
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue