mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-17 13:17:55 +08:00
refactor envelope with clap derive api
This commit is contained in:
@@ -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,5 +1,4 @@
|
||||
pub mod arg;
|
||||
pub mod args;
|
||||
pub mod table;
|
||||
|
||||
pub use table::*;
|
||||
|
||||
Reference in New Issue
Block a user