refactor envelope with clap derive api

This commit is contained in:
Clément DOUIN
2023-12-06 23:12:06 +01:00
parent 4a77253c1d
commit 2c33dd2f9f
14 changed files with 304 additions and 642 deletions
-21
View File
@@ -1,21 +0,0 @@
use clap::{Arg, ArgMatches};
const ARG_MAX_TABLE_WIDTH: &str = "max-table-width";
pub(crate) type MaxTableWidth = Option<usize>;
/// Represents the max table width argument.
pub fn max_width() -> Arg {
Arg::new(ARG_MAX_TABLE_WIDTH)
.help("Defines a maximum width for the table")
.long("max-width")
.short('w')
.value_name("INT")
}
/// Represents the max table width argument parser.
pub fn parse_max_width(matches: &ArgMatches) -> Option<usize> {
matches
.get_one::<String>(ARG_MAX_TABLE_WIDTH)
.and_then(|s| s.parse().ok())
}
-1
View File
@@ -1,5 +1,4 @@
pub mod arg;
pub mod args;
pub mod table;
pub use table::*;