use clap::Parser; use super::runner::Runner; use super::service::KcpService; #[derive(Clone, Debug, Parser)] #[command(about = "Interact with running socialweb-computer kcp servers")] pub struct ServerArgs { /// Run every command through this SSH host, for example "hat-7". #[arg(long)] pub ssh: Option, /// Prefix kubectl, find, and shell commands with "sudo -n". #[arg(long)] pub sudo: bool, /// kubectl executable name or path. #[arg(long)] pub kubectl: Option, /// State root to search for kcp admin kubeconfigs. Repeatable. #[arg(long = "root", action = clap::ArgAction::Append)] pub roots: Vec, /// Explicit admin kubeconfig. Repeatable. Disables root discovery when set. #[arg(long = "kubeconfig", action = clap::ArgAction::Append)] pub kubeconfigs: Vec, /// Allow operations on protected production hosts. #[arg(long)] pub allow_prod: bool, } pub fn service_from_args(args: ServerArgs) -> KcpService { let runner = Runner::new(args.ssh, args.sudo, args.kubectl); KcpService::new(runner, args.roots, args.kubeconfigs, args.allow_prod) }