caretta_sync_cli/cli/device/
mod.rs1mod info;
2mod list;
3mod ping;
4mod remove;
5mod scan;
6mod verification;
7
8use caretta_sync_core::utils::runnable::Runnable;
9pub use info::DeviceInfoCommandArgs;
10pub use list::DeviceListCommandArgs;
11pub use ping::DevicePingCommandArgs;
12pub use remove::DeviceRemoveCommandArgs;
13pub use scan::DeviceScanCommandArgs;
14
15use clap::{Args, Subcommand};
16
17#[derive(Debug, Args)]
18pub struct DeviceCommandArgs {
19 #[command(subcommand)]
20 pub command: DeviceSubcommand,
21}
22
23impl Runnable for DeviceCommandArgs {
24 fn run(self, app_name: &'static str) {
25 self.command.run(app_name)
26 }
27}
28
29#[derive(Debug, Subcommand)]
30pub enum DeviceSubcommand {
31 Info(DeviceInfoCommandArgs),
32 List(DeviceListCommandArgs),
33 Ping(DevicePingCommandArgs),
34 Remove(DeviceRemoveCommandArgs),
35 Scan(DeviceScanCommandArgs),
36}
37
38impl Runnable for DeviceSubcommand {
39 fn run(self, app_name: &'static str) {
40 match self {
41 Self::Info(x) => x.run(app_name),
42 Self::List(x) => x.run(app_name),
43 Self::Ping(x) => x.run(app_name),
44 Self::Remove(x) => x.run(app_name),
45 Self::Scan(x) => x.run(app_name),
46 }
47 }
48}