diff --git a/README.md b/README.md index 32350f9..49c9507 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,12 @@ input: |--------------------------| |--------------| /long/path/to/some/ebook.pdf | Title Of Ebook ____ - \ - example usage: \ - -------------- \__________________ - ___\_ - colmap --field-1='basename {}' --field-2="awk { print $1 }" - _________________|: x-arg + | + example usage: | x:arg + -------------- | + ---------------- + colmap 'basename {}' "awk { print $1 }" + #OR colmap -f1 'basename {}' -f2 'awk { print $1 }' @@ -45,20 +45,14 @@ foo_cmd | colmap --field-1='basename {}' --field-2="awk { print $1 }" foo_cmd | colmap -f1 'basename {}' -f2 'awk { print $1 }' ``` -2. Passing an `xarg template` +2. Passing `xargs` as positional arguments ```shell -foo_cmd | colmap -t 'basename {}' 'awk { print $2 }' +foo_cmd | colmap 'basename {}' 'awk { print $2 }' ``` - --- [I am using Github under protest](protest.md) -TODO: ----- - -[ ] use golden tests -[ ] use non-dashed cli like (rwxrob/bonzai) diff --git a/src/lib.rs b/src/lib.rs index 48e0d55..de25050 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,8 +5,14 @@ use regex::Regex; use std::result; use std::ops::Index; use std::slice::SliceIndex; +use crate::parsing::DEFAULT_SEP_PATTERN; -pub const DEFAULT_SEP_PATTERN: &str = r"[\t]+"; + +pub mod parsing { + + pub const DEFAULT_SEP_PATTERN: &str = r"[\t]+"; + +} type Column = Vec; diff --git a/src/main.rs b/src/main.rs index b26653f..2d288db 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,7 @@ */ use clap::Parser; -use colmap::DEFAULT_SEP_PATTERN; +use colmap::parsing::DEFAULT_SEP_PATTERN; #[derive(Parser)] /// colmap - map commands to columns of text input @@ -22,8 +22,8 @@ use colmap::DEFAULT_SEP_PATTERN; struct Cli { /// separator character used to split text into columns #[arg(default_value_t=DEFAULT_SEP_PATTERN.to_owned())] - #[arg(short, long = "sep")] - separator: String, + #[arg(short)] + delimiter: String, #[arg(short, long, action = clap::ArgAction::Count)] debug: u8, @@ -41,7 +41,7 @@ fn main() { // } if cli.debug > 0 { - println!("{:?}", cli.separator); + println!("{:?}", cli.delimiter); } for c in cli.commands {