summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock66
-rw-r--r--Cargo.toml4
-rw-r--r--shell.nix3
-rw-r--r--vegilctl/Cargo.toml2
-rw-r--r--vegilctl/src/args_dispatcher.rs0
-rw-r--r--vegilctl/src/main.rs39
6 files changed, 103 insertions, 11 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 42405ad..958566a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -59,6 +59,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8"
dependencies = [
"clap_builder",
+ "clap_derive",
]
[[package]]
@@ -74,6 +75,18 @@ dependencies = [
]
[[package]]
+name = "clap_derive"
+version = "4.5.49"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671"
+dependencies = [
+ "heck",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
name = "clap_lex"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -86,21 +99,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
[[package]]
-name = "errno"
-version = "0.3.14"
+name = "heck"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
-dependencies = [
- "libc",
- "windows-sys",
-]
+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "init"
version = "0.1.0"
dependencies = [
- "errno",
"libc",
+ "liblmod",
]
[[package]]
@@ -116,18 +125,59 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091"
[[package]]
+name = "liblmod"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b221585d3f0053b5b80768e115b50edcd5c423b703a9c2c5cbf4bcf417ab227c"
+
+[[package]]
name = "once_cell_polyfill"
version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
[[package]]
+name = "proc-macro2"
+version = "1.0.103"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.42"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
name = "strsim"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
+name = "syn"
+version = "2.0.111"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
+
+[[package]]
name = "utf8parse"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 2ccb4e1..8c9be6f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,9 @@
[workspace]
members = ["init", "vegilctl"]
+resolver = "3"
+
+[workspace.package]
+edition = "2024"
license = "GPL-2.0-only"
[profile.release]
diff --git a/shell.nix b/shell.nix
index d484ed5..fa924d8 100644
--- a/shell.nix
+++ b/shell.nix
@@ -4,7 +4,8 @@
pkgs.mkShell {
buildInputs = with pkgs; [
- rustup
+ rustc
+ cargo
pkg-config
rust-analyzer
gcc
diff --git a/vegilctl/Cargo.toml b/vegilctl/Cargo.toml
index 73077a8..0a89458 100644
--- a/vegilctl/Cargo.toml
+++ b/vegilctl/Cargo.toml
@@ -5,4 +5,4 @@ edition = "2024"
description = "Vegil init user control."
[dependencies]
-clap = "4.5.53"
+clap = { version = "4.5.53", features = [ "derive"]}
diff --git a/vegilctl/src/args_dispatcher.rs b/vegilctl/src/args_dispatcher.rs
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/vegilctl/src/args_dispatcher.rs
diff --git a/vegilctl/src/main.rs b/vegilctl/src/main.rs
index e7a11a9..08ff37c 100644
--- a/vegilctl/src/main.rs
+++ b/vegilctl/src/main.rs
@@ -1,3 +1,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() {
- println!("Hello, world!");
+ let args = Cli::parse();
+
+ println!("command: {:?}", args.command);
}