keyfork-seed: make bin into lib with bin
This commit is contained in:
parent
2e9bfde9b4
commit
fe8b901bd3
|
@ -0,0 +1,37 @@
|
|||
use std::path::PathBuf;
|
||||
use keyfork_frame::{EncodeError, DecodeError};
|
||||
|
||||
pub mod cli;
|
||||
pub mod socket;
|
||||
pub mod client;
|
||||
|
||||
pub use client::Client;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum Error {
|
||||
#[error("The first argument to the command should be a derivation path")]
|
||||
Args,
|
||||
|
||||
#[error("The given path was incorrectly formatted: {0}")]
|
||||
ArgsFormat(#[from] keyfork_derive_util::path::Error),
|
||||
|
||||
#[error("Neither KEYFORK_SOCKET_PATH nor XDG_RUNTIME_DIR were set")]
|
||||
EnvVarsNotFound,
|
||||
|
||||
#[error("Socket was unable to connect to {1}: {0}")]
|
||||
Connect(std::io::Error, PathBuf),
|
||||
|
||||
#[error("Could not write to or from the socket: {0}")]
|
||||
Io(#[from] std::io::Error),
|
||||
|
||||
#[error("Could not perform bincode transformation: {0}")]
|
||||
Bincode(#[from] Box<bincode::ErrorKind>),
|
||||
|
||||
#[error("Could not perform frame transformation: {0}")]
|
||||
FrameEnc(#[from] EncodeError),
|
||||
|
||||
#[error("Could not perform frame transformation: {0}")]
|
||||
FrameDec(#[from] DecodeError),
|
||||
}
|
||||
|
||||
pub type Result<T, E = Error> = std::result::Result<T, E>;
|
|
@ -1,42 +1,9 @@
|
|||
use keyfork_derive_util::{request::*, DerivationPath};
|
||||
use keyfork_frame::*;
|
||||
use std::path::PathBuf;
|
||||
|
||||
mod cli;
|
||||
mod socket;
|
||||
mod client;
|
||||
use keyfork_derive_util::{request::{DerivationRequest, DerivationAlgorithm}, DerivationPath};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum Error {
|
||||
#[error("The first argument to the command should be a derivation path")]
|
||||
Args,
|
||||
|
||||
#[error("The given path was incorrectly formatted: {0}")]
|
||||
ArgsFormat(#[from] keyfork_derive_util::path::Error),
|
||||
|
||||
#[error("Neither KEYFORK_SOCKET_PATH nor XDG_RUNTIME_DIR were set")]
|
||||
EnvVarsNotFound,
|
||||
|
||||
#[error("Socket was unable to connect to {1}: {0}")]
|
||||
Connect(std::io::Error, PathBuf),
|
||||
|
||||
#[error("Could not write to or from the socket: {0}")]
|
||||
Io(#[from] std::io::Error),
|
||||
|
||||
#[error("Could not perform bincode transformation: {0}")]
|
||||
Bincode(#[from] Box<bincode::ErrorKind>),
|
||||
|
||||
#[error("Could not perform frame transformation: {0}")]
|
||||
FrameEnc(#[from] EncodeError),
|
||||
|
||||
#[error("Could not perform frame transformation: {0}")]
|
||||
FrameDec(#[from] DecodeError),
|
||||
}
|
||||
|
||||
pub type Result<T, E = Error> = std::result::Result<T, E>;
|
||||
use keyfork_seed::*;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let args = cli::get_args();
|
||||
|
|
Loading…
Reference in New Issue