cli-diary 0.8.0

A CLI based diary tool for adding entries on the fly.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::{error, path::PathBuf};

use tempfile::{tempdir, NamedTempFile};

pub type TestReturn = Result<(), Box<dyn error::Error>>;

#[allow(dead_code)]
pub fn create_temp_dir_and_path() -> Result<(String, PathBuf), Box<dyn error::Error>> {
    let dir_str = tempdir()?.path().to_str().unwrap().to_string();

    let config_file = NamedTempFile::new()?;
    let config_path = config_file.path().to_owned();
    config_file.close()?;

    Ok((dir_str, config_path))
}