1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
use clap::{Parser, Subcommand};
#[derive(Subcommand, Clone, Debug)]
enum Command {
/// Check Service Status
Status { of: String },
/// Stop Specified Service
Stop { service: String },
/// Start Specified Service
Start { service: String },
/// Start Service after system initialization (Add Service symlink to Vigil service startup
/// list)
Enable { service: String },
/// Remove Service From Service initialization list
Disable { service: String },
/// Power Management Commands
#[command(subcommand)]
Power(PowerCommand),
}
#[derive(Subcommand, Clone, Debug)]
enum PowerCommand {
/// Reboot System
Reboot,
/// Poweroff System
Poweroff,
/// Halt
Halt,
}
#[derive(Parser)]
#[command(name = "vigilctl")]
#[command(about = "Vigil control manager")]
struct Cli {
#[command(subcommand)]
command: Command,
}
fn main() {
let args = Cli::parse();
println!("command: {:?}", args.command);
}
|