From db0d59957734fe6291f5c09318a1278959198eab Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 29 Nov 2024 14:31:40 +0000 Subject: [PATCH] feat: define command arguments to parse --- Cargo.toml | 2 +- src/lib.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 03d972c..4eeb76f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] #bytes = "1.9" -#clap = { version = "4.5", features = ["cargo", "derive"] } +clap = { version = "4.5", features = ["cargo", "derive"] } color-eyre = "0.6" #derive_more = { version = "1.0", features = [ # "as_ref", diff --git a/src/lib.rs b/src/lib.rs index 017a991..4b861bf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,22 @@ // use std::path::PathBuf; +use clap::Parser; use kxio::{fs::FileSystem, net::Net}; +#[derive(Parser, Debug)] +#[clap(version = clap::crate_version!(), author = clap::crate_authors!(), about = clap::crate_description!())] +struct Commands { + #[clap(subcommand)] + command: Command, +} +#[derive(Parser, Debug)] +enum Command { + Init, + Check, + Import, +} + #[derive(Clone)] pub struct Ctx { pub fs: FileSystem,