do some work on jrnl
This commit is contained in:
parent
d78a0b1c09
commit
bd60655fcc
5 changed files with 28 additions and 342 deletions
|
@ -1,5 +1,8 @@
|
|||
use clap::{Parser, Subcommand};
|
||||
use std::{fs, io, path::PathBuf};
|
||||
use std::{
|
||||
fs, io,
|
||||
path::{self, Path, PathBuf},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
commands::add_entry::add_entry,
|
||||
|
@ -31,13 +34,14 @@ fn main() -> io::Result<()> {
|
|||
let cli = Cli::parse();
|
||||
println!("Hello, world!");
|
||||
println!("cli: {cli:#?}");
|
||||
let path = dbg!(path::absolute(&cli.s10e_jrnl_file_loc)?);
|
||||
|
||||
match cli.command {
|
||||
Some(Command::ListEntries) => list_entries(cli.s10e_jrnl_file_loc.clone()),
|
||||
Some(Command::Add { title }) => add_entry(cli.s10e_jrnl_file_loc.clone(), title),
|
||||
Some(Command::ListEntries) => list_entries(&path),
|
||||
Some(Command::Add { title }) => add_entry(&path, title),
|
||||
None => {
|
||||
// TODO: handle btter
|
||||
let file = fs::read_to_string(cli.s10e_jrnl_file_loc)?;
|
||||
let file = fs::read_to_string(path)?;
|
||||
|
||||
let doc = Doc::new(&file).unwrap();
|
||||
println!("{}", doc.to_md());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue