Skip to content

Commit

Permalink
make the crate usable as a lib
Browse files Browse the repository at this point in the history
  • Loading branch information
glehmann committed Feb 2, 2024
1 parent 7a91023 commit 696b966
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
12 changes: 12 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
30 changes: 14 additions & 16 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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(())
Expand Down

0 comments on commit 696b966

Please sign in to comment.