wip: map process to yarg

main
blob42 8 months ago
parent 5c5c8875fa
commit 600f1d5ed3

@ -1,6 +1,6 @@
1. parse cli parameters
2. read from stdin
3. split stdin into columns
3. map (execute) commands to fields
1. parse cli parameters
2. read from stdin
3. split stdin into columns
3. map (execute) commands to fields
- [ ] execute a command on first text column
4. print resulting concatenated columns

@ -13,7 +13,7 @@ use yargs::{DEFAULT_SEP_PATTERN, stdin};
use yargs::parse::InputText;
use anyhow::Result;
use std::io::{BufRead, Read, BufReader, stdin};
use std::process;
use std::process::{self, Command, Stdio};
#[derive(Parser)]
@ -102,10 +102,21 @@ fn main() -> Result<()> {
eprintln!("======");
}
assert!(input_text.n_cols()? >= cli.yargs.len());
// TODO: RESULT
print!("{}", raw_input);
if cli.yargs.is_empty() {
print!("{}", raw_input);
} else {
// Handle yargs
// Exec each yarg as a process for each column
// yarg #1 for column 1, yarg #2 -> col 2 ...
// we know we have at least one elm
let yarg = cli.yargs.first().unwrap();
let yarg_cmd = Command::new(yarg)
.stdout(Stdio::piped())
.spawn()
.expect(&format!("Failed to exec {yarg}"));
}
Ok(())

Loading…
Cancel
Save