use std::net::IpAddr; use clap::Args; use clap::Parser; use clap::Subcommand; #[derive(Parser)] #[command(author, about, version, arg_required_else_help = true)] pub struct Arguments { #[command(subcommand)] pub command: Option, /// Verbose output #[arg(short, long, global = true)] pub verbose: bool, } #[derive(Subcommand)] pub enum Commands { /// Login to the campus network Login(ClientArgs), /// Logout from the campus network Logout(ClientArgs), /// Check device login status Status(StatusArgs), /// List all possible config file paths ConfigPaths, /// Poll the server with login requests to keep the session alive KeepAlive(DaemonArgs), } #[derive(Args)] pub struct StatusArgs { /// Output JSON literal #[arg(short, long)] pub json: bool, } #[derive(Args)] pub struct ClientArgs { /// Your campus username #[arg(short, long)] pub username: Option, /// Your campus password #[arg(short, long)] pub password: Option, /// Manually specify IP address (IPv4) #[arg(long)] pub ip: Option, /// Use alternative `dm` logout endpoint for registered dumb terminals #[arg(long)] pub dm: bool, /// Optionally provide path to the config file #[arg(short, long)] pub config: Option, /// Force login/logout, don't check login status #[arg(short, long)] pub force: bool, } #[derive(Args)] pub struct DaemonArgs { /// Path to the config file #[arg(short, long)] pub config: Option, }