You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.5 KiB
Markdown

Very much work in progress. This is the first project in my Rust learning journey.
Expect a lot of changes and refactoring.
1 year ago
# Colmap
Colmap is hybrid between `awk` in `xargs`. It borrows from the former its ability
to work on tabular columns of text and allows for arbitrary commands to be
applied per column in a similar way to `xargs`.
The columns are called `fields`. The command to execute on each field is called
an `x-arg`.
1 year ago
## Example
input:
1 year ago
1 year ago
field #1 field #2
|--------------------------| |--------------|
/long/path/to/some/ebook.pdf | Title Of Ebook
1 year ago
____
1 year ago
\
example usage: \
1 year ago
-------------- \__________________
___\_
1 year ago
colmap --field-1='basename {}' --field-2="awk { print $1 }"
_________________|: x-arg
#OR
1 year ago
colmap -f1 'basename {}' -f2 'awk { print $1 }'
1 year ago
would output: `ebook.pdf | Title`
1 year ago
- use colon as delimiter
1 year ago
`colmap -d':' -f1 '...'`
### Ways of passing x-args
1. passing column x-args as fields
```shell
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`
1 year ago
```shell
foo_cmd | colmap -t 'basename {}' 'awk { print $2 }'
```
1 year ago
---
[I am using Github under protest](protest.md)
TODO:
----
[ ] use non-dashed approach to cli (rwxrob/bonzai)