The TUI arm of the umbrella binary hardcoded http://127.0.0.1:7070 instead of going through MaestroConfigFile::resolve_daemon_url, which every CLI subcommand uses. On a host whose [daemon].bind_addr is not the default port, `maestro list` worked and `maestro tui` could not connect. RunConfig.daemon_url is now the override rather than the final URL; the TUI resolves it against the config file it already loads for its UI settings. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
43 lines
1.1 KiB
Rust
43 lines
1.1 KiB
Rust
//! Clap-derive subcommand definition for `maestro tui`.
|
|
|
|
#[derive(Debug, clap::Args)]
|
|
pub struct TuiArgs {
|
|
/// Override the local daemon's HTTP base URL. Defaults to
|
|
/// `[cli].daemon_url`, then the local `[daemon].bind_addr`, then
|
|
/// `http://127.0.0.1:7070`.
|
|
#[arg(long, env = "MAESTRO_DAEMON_URL")]
|
|
pub daemon_url: Option<String>,
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
use clap::Parser;
|
|
|
|
#[derive(Debug, Parser)]
|
|
struct Harness {
|
|
#[command(subcommand)]
|
|
cmd: Cmd,
|
|
}
|
|
|
|
#[derive(Debug, clap::Subcommand)]
|
|
enum Cmd {
|
|
Tui(TuiArgs),
|
|
}
|
|
|
|
#[test]
|
|
fn parses_with_daemon_url() {
|
|
let h = Harness::try_parse_from(["maestro", "tui", "--daemon-url", "http://10.0.0.1:7070"])
|
|
.unwrap();
|
|
let Cmd::Tui(args) = h.cmd;
|
|
assert_eq!(args.daemon_url.as_deref(), Some("http://10.0.0.1:7070"));
|
|
}
|
|
|
|
#[test]
|
|
fn parses_without_daemon_url() {
|
|
let h = Harness::try_parse_from(["maestro", "tui"]).unwrap();
|
|
let Cmd::Tui(args) = h.cmd;
|
|
assert!(args.daemon_url.is_none());
|
|
}
|
|
}
|