summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortuturuu <zedddiezxc@gmail.com>2026-01-10 04:50:51 +0100
committertuturuu <zedddiezxc@gmail.com>2026-01-10 04:50:51 +0100
commit2ed528ef4f9ea35d7cfbd1b46a5d3c5036fcc409 (patch)
treeec4d74249a1e6f8ea837cb69a3d2797e9b504565
parent5b64295b480f8c8fe5b2584a9b7f94674655183c (diff)
Cli skeleton, basic enums
-rw-r--r--vegilctl/src/main.rs36
1 files changed, 35 insertions, 1 deletions
diff --git a/vegilctl/src/main.rs b/vegilctl/src/main.rs
index e7a11a9..cbfc2f2 100644
--- a/vegilctl/src/main.rs
+++ b/vegilctl/src/main.rs
@@ -1,3 +1,37 @@
+#[derive(Debug)]
+enum Command {
+ Status,
+ Stop,
+ Start,
+ Enable,
+ Disable,
+}
+struct CliArgs {
+ command: Command,
+ target: String
+}
fn main() {
- println!("Hello, world!");
+ let command:Command = match std::env::args().nth(1).as_deref(){
+ Some("status") => Command::Status,
+ Some("start") => Command::Start,
+ Some("stop") => Command::Stop,
+ Some("enable") => Command::Enable,
+ Some("disable") => Command::Disable,
+ Some(cmd) => {
+ eprintln!("invalid command arg:{}", cmd);
+ std::process::exit(1);
+ }
+ None => {
+ eprintln!("Invalid input: No command arg specified\nRun with --help to get help");
+ std::process::exit(1);
+ }
+ };
+ let target = std::env::args().nth(2).expect("no target arg specified");
+
+ let args = CliArgs {
+ command,
+ target
+ };
+
+ println!("command: {:?}, target: {:?}", args.command, args.target);
}