arachnid_cli/cli/cmd/
connect.rs1#[derive(
8 Clone,
9 Debug,
10 Default,
11 Eq,
12 Hash,
13 Ord,
14 PartialEq,
15 PartialOrd,
16 clap::Parser,
17 serde::Deserialize,
18 serde::Serialize,
19)]
20pub struct ConnectCmd {
21 #[clap(subcommand)]
22 pub args: Option<ConnectOpts>,
23 #[clap(long, short = 'H')]
24 pub host: Option<String>,
25 #[clap(long, short)]
26 pub port: Option<u16>,
27 #[clap(long, short)]
28 pub workdir: Option<String>,
29}
30
31#[derive(
32 Clone,
33 Debug,
34 Eq,
35 Hash,
36 Ord,
37 PartialEq,
38 PartialOrd,
39 clap::Subcommand,
40 serde::Deserialize,
41 serde::Serialize,
42)]
43pub enum ConnectOpts {
44 Run {
45 #[clap(long, short)]
46 prefix: Option<String>,
47 },
48}
49
50impl ConnectCmd {
55 pub fn new() -> Self {
56 clap::Parser::parse()
57 }
58 pub fn args(&self) -> Option<&ConnectOpts> {
60 self.args.as_ref()
61 }
62 pub fn host(&self) -> Option<&str> {
64 self.host.as_deref()
65 }
66 pub fn port(&self) -> Option<u16> {
68 self.port
69 }
70 #[tracing::instrument(skip_all, target = "cli")]
72 pub async fn handle(&self, _ctx: &mut crate::Context) -> anyhow::Result<()> {
73 tracing::info!("Handling 'connect' command with args: {:?}", self);
74 Ok(())
75 }
76}