Start: Arg parsing structures

Fortune for transfer's current commit: Small curse − 小凶
basic
Avril 3 years ago
parent b77d33fa8d
commit c8f616ae97
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -42,7 +42,8 @@ impl fmt::Display for Usage
splash(f)?;
writeln!(f, "Usage: {} --send <bind> [SEND OPTIONS] <file...>", program_name())?;
writeln!(f, "Usage: {} --recv <endpoint> [RECV OPTIONS] <output...>", program_name())?;
writeln!(f, "Usage: {} --recv <connect> [RECV OPTIONS] <output...>", program_name())?;
writeln!(f, "Usage: {} --help", program_name())?;
writeln!(f, "\nSEND OPTIONS:")?;
writeln!(f, " -e\t\t\tEncrypt file(s)")?;
writeln!(f, " -c\t\t\tCompress files")?;
@ -58,3 +59,23 @@ impl fmt::Display for Usage
Ok(())
}
}
/// The process parsed from command line
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Process
{
/// The parsed config (includes mode)
pub config: config::Config,
/// The listed paths
pub paths: Vec<String>,
/// Use stdin/out
pub stdio: bool,
}
/// An operation parsed from command line arguments
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Op
{
Process(Box<Process>),
Help,
}

@ -20,8 +20,11 @@ use serde::{
pub enum CompressionKind
{
Brotli,
//TODO: Add cases (and async_compression features) for these three
Xz,
GZip,
Bz2,
}
impl Default for CompressionKind
@ -29,6 +32,7 @@ impl Default for CompressionKind
#[inline]
fn default() -> Self
{
//TODO: Should Brotli be default? Check sizes of compressed binary encoded stuffs and compare modes.
Self::Brotli
}
}

Loading…
Cancel
Save