Add help messages
This commit is contained in:
parent
a63ae7d0ed
commit
e7596f0276
11
src/set.rs
11
src/set.rs
@ -11,10 +11,17 @@ use std::{collections::HashSet, io::Write, str::FromStr};
|
|||||||
|
|
||||||
#[derive(clap::StructOpt, Debug)]
|
#[derive(clap::StructOpt, Debug)]
|
||||||
pub struct Options {
|
pub struct Options {
|
||||||
#[clap(min_values = 1, max_values = 3)]
|
#[clap(
|
||||||
|
min_values = 1,
|
||||||
|
max_values = 3,
|
||||||
|
help = "Register operation and operand. Empty register is current selection. Example: 'a-b' or '+b'"
|
||||||
|
)]
|
||||||
args: Vec<String>,
|
args: Vec<String>,
|
||||||
|
|
||||||
#[clap(short = 'T')]
|
#[clap(
|
||||||
|
short = 'T',
|
||||||
|
help = "Do not trim the selections before doing set operations"
|
||||||
|
)]
|
||||||
no_trim: bool,
|
no_trim: bool,
|
||||||
// #[clap(short, long)]
|
// #[clap(short, long)]
|
||||||
// regex: Option<Regex>,
|
// regex: Option<Regex>,
|
||||||
|
17
src/sort.rs
17
src/sort.rs
@ -5,20 +5,23 @@ use std::{cmp::Ordering, io::Write};
|
|||||||
|
|
||||||
#[derive(clap::StructOpt, Debug)]
|
#[derive(clap::StructOpt, Debug)]
|
||||||
pub struct Options {
|
pub struct Options {
|
||||||
#[clap(index = 1)]
|
#[clap(index = 1, help = "Optional regex comparison key")]
|
||||||
regex: Option<Regex>,
|
regex: Option<Regex>,
|
||||||
#[clap(short = 's', long)]
|
#[clap(
|
||||||
|
short = 's',
|
||||||
|
long,
|
||||||
|
help = "Optional register for using subselection ma tching"
|
||||||
|
)]
|
||||||
subselections_register: Option<char>,
|
subselections_register: Option<char>,
|
||||||
// TODO: Can we invert a boolean? This name is terrible
|
// TODO: Can we invert a boolean? This name is terrible
|
||||||
#[clap(short = 'S', long, parse(try_from_str = invert_bool), default_value_t)]
|
#[clap(short = 'S', long, parse(try_from_str = invert_bool), default_value_t, help = "Do not treat trimmed value of selections when sorting")]
|
||||||
no_skip_whitespace: bool,
|
no_skip_whitespace: bool,
|
||||||
#[clap(short, long)]
|
#[clap(short, long, help = "Sort numbers lexicographically")]
|
||||||
lexicographic_sort: bool,
|
lexicographic_sort: bool,
|
||||||
#[clap(short, long)]
|
#[clap(short, long, help = "Reverse sorting")]
|
||||||
reverse: bool,
|
reverse: bool,
|
||||||
#[clap(short, long)]
|
#[clap(short, long, help = "Ignore case when sorting")]
|
||||||
ignore_case: bool,
|
ignore_case: bool,
|
||||||
// TODO: Sort by character ([xba] => [abx])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn invert_bool(s: &str) -> Result<bool, &'static str> {
|
fn invert_bool(s: &str) -> Result<bool, &'static str> {
|
||||||
|
10
src/trim.rs
10
src/trim.rs
@ -3,11 +3,15 @@ use std::io::Write;
|
|||||||
|
|
||||||
#[derive(clap::StructOpt, Debug)]
|
#[derive(clap::StructOpt, Debug)]
|
||||||
pub struct Options {
|
pub struct Options {
|
||||||
#[clap(short, long)]
|
#[clap(short, long, help = "Trim from left")]
|
||||||
left: bool,
|
left: bool,
|
||||||
#[clap(short, long)]
|
#[clap(short, long, help = "Trim right side")]
|
||||||
right: bool,
|
right: bool,
|
||||||
#[clap(short, long)]
|
#[clap(
|
||||||
|
short,
|
||||||
|
long,
|
||||||
|
help = "If selection ends in a newline, do not add the newline back after trimming"
|
||||||
|
)]
|
||||||
no_preserve_newline: bool,
|
no_preserve_newline: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,12 +8,12 @@ use std::collections::BTreeSet;
|
|||||||
|
|
||||||
#[derive(clap::StructOpt, Debug)]
|
#[derive(clap::StructOpt, Debug)]
|
||||||
pub struct Options {
|
pub struct Options {
|
||||||
#[clap(index = 1)]
|
#[clap(index = 1, help = "Optional regex to compare unique elements")]
|
||||||
regex: Option<Regex>,
|
regex: Option<Regex>,
|
||||||
#[clap(short, long)]
|
#[clap(short, long, help = "Ignore the case when comparing")]
|
||||||
ignore_case: bool,
|
ignore_case: bool,
|
||||||
// TODO: Can we invert a boolean? This name is terrible
|
// TODO: Can we invert a boolean? This name is terrible
|
||||||
#[clap(short = 'S', long)]
|
#[clap(short = 'S', long, help = "Do not skip whitespace when comparing")]
|
||||||
no_skip_whitespace: bool,
|
no_skip_whitespace: bool,
|
||||||
}
|
}
|
||||||
pub fn uniq(options: &Options) -> Result<String, KakError> {
|
pub fn uniq(options: &Options) -> Result<String, KakError> {
|
||||||
|
Loading…
Reference in New Issue
Block a user