wip test column input

main
blob42 1 year ago
parent a229048218
commit 291f89e2cd

@ -30,7 +30,22 @@ WILL OUPUT:
ebook.pdf | Title
---
[I am using Github under protest](protest.md)
TODO:
----
[ ] use non-dashed approach to cli (rwxrob/bonzai)

@ -0,0 +1,21 @@
type Column = Vec<String>;
type Columns = Vec<Column>;
// split input text into columns based on separator character
// returns a type representing a variable length array of strings (columns) ?
pub fn split_columns(text: &str, sep: char) -> Option<Columns> {
Some(Columns::new())
}
#[test]
fn test_split_columns(){
let coltext1 = r###"
file1.txt title1
file2.pdf title2
file3 title3
"###;
let columns = split_columns(coltext1, '\t');
println!("columns:\n{:?}", columns);
}

@ -1,6 +1,6 @@
/* TODO:
* 1. add clap for CLI flags
* 2. read input as column fields
* 2. read input as column field1920s
* 3. test splitting input into fields
* 4. execute arbitrary shell commands to manipulate input
*/
@ -8,6 +8,8 @@
use clap::{Parser};
use std::process;
mod input;
#[derive(Parser)]
#[command(name="colmap")]
@ -42,10 +44,11 @@ fn main() {
// 1. parse cli parameters
// 2. read from stdin
// 3. execute every field command on it's corresponding
// column
// 3. split stdin into columns (column/awk commands)
// 3. execute every field command on it's corresponding column
// [ ] execute a command on first text column
// 4. print resulting concatenated columns
if let None = cli.f1.as_deref() {
eprintln!("no field --fX to operate on");
@ -56,5 +59,7 @@ fn main() {
println!("{:?}", cli.separator.unwrap());
println!("{:?}", cli.f1.unwrap());
}
}

Loading…
Cancel
Save