do some work on jrnl
This commit is contained in:
parent
d78a0b1c09
commit
bd60655fcc
5 changed files with 28 additions and 342 deletions
|
@ -2,7 +2,7 @@ use std::{
|
|||
env,
|
||||
fs::{self, OpenOptions},
|
||||
io::{self, Write},
|
||||
path::PathBuf,
|
||||
path::{Path, PathBuf},
|
||||
process::Command,
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,7 @@ use temp_file::{TempFile, TempFileBuilder};
|
|||
use crate::md::{Entry, ToMd};
|
||||
|
||||
// TODO: the usual (better error handling)
|
||||
pub fn add_entry(path: PathBuf, title: Option<String>) -> io::Result<()> {
|
||||
pub fn add_entry(path: &Path, title: Option<String>) -> io::Result<()> {
|
||||
if !path.exists() {
|
||||
eprintln!("Journal file does not exist at {path:?}, exiting...");
|
||||
std::process::exit(1);
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
use owo_colors::OwoColorize;
|
||||
use std::{fs, io, path::PathBuf};
|
||||
use std::{
|
||||
fs, io,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use crate::md::Doc;
|
||||
|
||||
pub fn list_entries(path: PathBuf) -> io::Result<()> {
|
||||
pub fn list_entries(path: &Path) -> io::Result<()> {
|
||||
let file = fs::read_to_string(path)?;
|
||||
|
||||
if let Some(doc) = Doc::new(&file) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue