Version bump 0.3.0: Allow multiple groups specified, delimited per line by TAB-literal. Print warning when a non-existent group is requested instead of silently ignoring it.
//TODO: What should be the behaviour of a non-existent group index here? (NOTE: This now corresponds to the previous `g.len() > group` check in caller.) // (NOTE: The original behaviour is to just ignore groups that are out of range entirely (i.e. no printing, no delimit char, no error,) maybe treat non-existent groups as non-matched groups and *just* print the delim char?)
// (NOTE: Moved out of branch, see above ^) // None if !first => write!(to, "\t"),
// XXX: Should this do what it does now...? Or should it `break` to prevent the checking for more groups...? Print a warning maybe...?
None=>{
eprintln!("Warning: Invalid group index {}!",group);
continue;// Do not set `first = false` if it was an invalid index.
//Ok(())
},
}?;
first=false;
}
// If `first == true`, no groups were printed, so we do not print the new-line.
if!first{
to.write_all(b"\n")
}else{
Ok(())
}
}
@ -34,30 +62,49 @@ fn main() -> eyre::Result<()>
{
initialise().wrap_err("Fatal: Failed to install panic handle")?;