fix imports update readme

main
blob42 9 months ago
parent f29d8c449a
commit 7494d1ca3f

@ -19,12 +19,12 @@ input:
|--------------------------| |--------------| |--------------------------| |--------------|
/long/path/to/some/ebook.pdf | Title Of Ebook /long/path/to/some/ebook.pdf | Title Of Ebook
____ ____
\ |
example usage: \ example usage: | x:arg
-------------- \__________________ -------------- |
___\_ ----------------
colmap --field-1='basename {}' --field-2="awk { print $1 }" colmap 'basename {}' "awk { print $1 }"
_________________|: x-arg
#OR #OR
colmap -f1 'basename {}' -f2 'awk { print $1 }' 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 }' foo_cmd | colmap -f1 'basename {}' -f2 'awk { print $1 }'
``` ```
2. Passing an `xarg template` 2. Passing `xargs` as positional arguments
```shell ```shell
foo_cmd | colmap -t 'basename {}' 'awk { print $2 }' foo_cmd | colmap 'basename {}' 'awk { print $2 }'
``` ```
--- ---
[I am using Github under protest](protest.md) [I am using Github under protest](protest.md)
TODO:
----
[ ] use golden tests
[ ] use non-dashed cli like (rwxrob/bonzai)

@ -5,8 +5,14 @@ use regex::Regex;
use std::result; use std::result;
use std::ops::Index; use std::ops::Index;
use std::slice::SliceIndex; 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<String>; type Column = Vec<String>;

@ -7,7 +7,7 @@
*/ */
use clap::Parser; use clap::Parser;
use colmap::DEFAULT_SEP_PATTERN; use colmap::parsing::DEFAULT_SEP_PATTERN;
#[derive(Parser)] #[derive(Parser)]
/// colmap - map commands to columns of text input /// colmap - map commands to columns of text input
@ -22,8 +22,8 @@ use colmap::DEFAULT_SEP_PATTERN;
struct Cli { struct Cli {
/// separator character used to split text into columns /// separator character used to split text into columns
#[arg(default_value_t=DEFAULT_SEP_PATTERN.to_owned())] #[arg(default_value_t=DEFAULT_SEP_PATTERN.to_owned())]
#[arg(short, long = "sep")] #[arg(short)]
separator: String, delimiter: String,
#[arg(short, long, action = clap::ArgAction::Count)] #[arg(short, long, action = clap::ArgAction::Count)]
debug: u8, debug: u8,
@ -41,7 +41,7 @@ fn main() {
// } // }
if cli.debug > 0 { if cli.debug > 0 {
println!("{:?}", cli.separator); println!("{:?}", cli.delimiter);
} }
for c in cli.commands { for c in cli.commands {

Loading…
Cancel
Save