reactive_graph_client/client/system/remotes/
args.rs

1use clap::Args;
2
3use crate::client::system::remotes::commands::RemotesCommands;
4use reactive_graph_remotes_model::DEFAULT_PORT;
5use reactive_graph_remotes_model::InstanceAddress;
6
7#[derive(Args, Debug, Clone)]
8#[clap(subcommand_required = true)]
9pub(crate) struct RemotesArgs {
10    #[command(subcommand)]
11    pub(crate) commands: Option<RemotesCommands>,
12}
13
14#[derive(Args, Debug, Clone)]
15pub(crate) struct InstanceAddressArgs {
16    /// The hostname.
17    #[arg(long, required = true)]
18    pub hostname: String,
19
20    /// The port.
21    #[arg(long)]
22    pub port: Option<u16>,
23
24    /// The protocol.
25    #[arg(long)]
26    pub secure: Option<bool>,
27}
28
29impl From<InstanceAddressArgs> for InstanceAddress {
30    fn from(address: InstanceAddressArgs) -> Self {
31        InstanceAddress::new(address.hostname, address.port.unwrap_or(DEFAULT_PORT), address.secure.unwrap_or(false))
32    }
33}