Compare commits
2 Commits
7f4ab49c91
...
914a57692f
Author | SHA1 | Date |
---|---|---|
Trey Blancher | 914a57692f | |
Trey Blancher | d86822c40e |
|
@ -57,8 +57,8 @@ if [[ -f ${DATE} ]]; then
|
|||
subtotal=0
|
||||
for pattern in "${KEYS[@]}"; do
|
||||
#echo "pattern=${pattern}" >&2
|
||||
$grep -- "\[${pattern}\]" ${DATE} | timetracker
|
||||
subtotal=$(bc <<< "scale=2; ${subtotal} + $($grep -- "\[${pattern}\]" ${DATE} | timetracker | $grep "Section" | $grep -Po '\d+\.\d+hrs' | tr -d '[hrs]')")
|
||||
$grep -- "\[${pattern}\]" ${DATE} | python timetracker.py
|
||||
subtotal=$(bc <<< "scale=2; ${subtotal} + $($grep -- "\[${pattern}\]" ${DATE} | python timetracker.py | $grep "Section" | $grep -Po '\d+\.\d+hrs' | tr -d '[hrs]')")
|
||||
printf "Subtotal: %3.2fhrs\n" ${subtotal}
|
||||
echo
|
||||
if [[ "${WHOLE}x" == "x" ]]; then
|
||||
|
|
|
@ -130,7 +130,7 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "do_process"
|
||||
name = "doprocess"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"itertools",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
members = [
|
||||
"timetracker",
|
||||
"do_process",
|
||||
"doprocess",
|
||||
"chug",
|
||||
"timelogging"
|
||||
]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "do_process"
|
||||
name = "doprocess"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
|
@ -6,6 +6,9 @@ use itertools::Itertools;
|
|||
use timelogging::timetracking::{nearest, process_input_file, generate_individual_timecards};
|
||||
|
||||
fn main() {
|
||||
// set up a regex for escaping regex characters
|
||||
let cat_esc = Regex::new(r"(?P<char>[-*^$+?])").unwrap();
|
||||
|
||||
// Process the file (stdin or file argument)
|
||||
let input = env::args().nth(1);
|
||||
let mut reader: Box<dyn BufRead> = match input {
|
||||
|
@ -24,7 +27,10 @@ fn main() {
|
|||
let mut running_total: f64 = 0.0;
|
||||
for cat in categories {
|
||||
let mut subtotal: f64 = 0.0;
|
||||
let catre = Regex::new(&format!(r"\[{}\]\s+.*\s*$", cat).to_string()).unwrap();
|
||||
let catre = Regex::new(&format!(r"\[{}\]\s+.*\s*$",
|
||||
cat_esc.replace_all(&cat, r"\$char".to_string()))
|
||||
.to_string())
|
||||
.unwrap();
|
||||
for (act, duration) in ind.iter().sorted_by_key(|x| x.0) {
|
||||
if ! catre.is_match(&act.to_string()) {
|
||||
continue
|
||||
|
@ -49,3 +55,4 @@ fn main() {
|
|||
|
||||
println!("{}", format!("Grand total: {:.2}", gtoth));
|
||||
}
|
||||
|
Loading…
Reference in New Issue