From 696b9668e2b2d4be53b3bff5d88275b70010c74b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Lehmann?= Date: Fri, 2 Feb 2024 15:57:15 +0100 Subject: [PATCH] make the crate usable as a lib --- src/lib.rs | 12 ++++++++++++ src/main.rs | 30 ++++++++++++++---------------- 2 files changed, 26 insertions(+), 16 deletions(-) create mode 100644 src/lib.rs diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..66a4425 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,12 @@ +#[macro_use] +extern crate log; + +pub mod cli; +pub mod decrypt; +pub mod edit; +pub mod encrypt; +pub mod env; +pub mod error; +pub mod keygen; +pub mod pubkey; +pub mod util; diff --git a/src/main.rs b/src/main.rs index b0836d6..a754c7e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,17 +2,15 @@ extern crate log; use clap::Parser; -use cli::Commands; -mod cli; -mod decrypt; -mod edit; -mod encrypt; -mod env; -mod error; -mod keygen; -mod pubkey; -mod util; +use yage::cli; +use yage::decrypt; +use yage::edit; +use yage::encrypt; +use yage::env; +use yage::error; +use yage::keygen; +use yage::pubkey; fn run() -> error::Result<()> { let cli = cli::Cli::parse(); @@ -26,12 +24,12 @@ fn run() -> error::Result<()> { } match cli.command.unwrap() { - Commands::Keygen(ref args) => keygen::keygen(args)?, - Commands::Pubkey(ref args) => pubkey::pubkey(args)?, - Commands::Edit(ref args) => edit::edit(args)?, - Commands::Encrypt(ref args) => encrypt::encrypt(args)?, - Commands::Decrypt(ref args) => decrypt::decrypt(args)?, - Commands::Env(ref args) => env::env(args)?, + cli::Commands::Keygen(ref args) => keygen::keygen(args)?, + cli::Commands::Pubkey(ref args) => pubkey::pubkey(args)?, + cli::Commands::Edit(ref args) => edit::edit(args)?, + cli::Commands::Encrypt(ref args) => encrypt::encrypt(args)?, + cli::Commands::Decrypt(ref args) => decrypt::decrypt(args)?, + cli::Commands::Env(ref args) => env::env(args)?, } Ok(())