#timewarrior #timew #timelogging

timewarrior-rs

An interface to use data logged by the timew utility

1 unstable release

0.4.4 Jul 24, 2023

#1200 in Database interfaces

24 downloads per month

GPL-2.0-or-later

26KB
727 lines

timewarrior-rs is a library providing access to the timewarrior time tracking utility. It currently only provides access to the data parsed from the local database.

Example

use timewarrior_rs::formatter;

fn main() -> Result<(), String> {
    let range = Range::today().unwrap();

    println!("Loading TimeWarrior for {}... ", range);
    let work = formatter::raw(Some(range)).unwrap();

    for entry in work.entries() {
        println!("{entry}");
    }
    
    Ok(())
}

Will show the work of today

Future work

The next steps include:

  • Providing structs to easily show the output of the different timewarrior commands.
  • Add database editing through start/stop/modify/...

lib.rs:

timewarrior-rs

timewarrior-rs allows reading data logged by the timew utility. The current implementation only allows retrieving the raw data in a Vec<TimeEntry>: A list of TimeEntry elements.

Future improvement will allow formatting the data to be processed and shown like the different timew utility commands.

Even future work will allow adding entries in the database. Usage example:

 use timewarrior_rs::{ data, formatter };
 let range = data::Range::today().unwrap();
 let work = formatter::raw(Some(range)).unwrap();
 println!("{}", data::Range::pretty_duration(&work.duration()));
 for entry in work.entries() {
     println!("{entry}");
 }

Dependencies

~4–13MB
~132K SLoC