toggl 0.4.9

Unofficial command-line interface for Toggl Track using the v9 API.
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::path::Path;
use toml;

use crate::models::ResultWithDefaultError;

use super::model::TrackConfig;

pub fn get_config_from_file<P: AsRef<Path>>(path: P) -> ResultWithDefaultError<TrackConfig> {
    let contents = std::fs::read_to_string(path).expect("failed to read config file");
    let config: TrackConfig = toml::from_str(&contents).expect("failed to parse config");

    Ok(config)
}