generated from Astrial.org/template
Compare commits
No commits in common. "5c30144507915e4e2a6cf043d0faec33c489465f" and "feeac0ff2d7e694fc0176d082297168561f578a4" have entirely different histories.
5c30144507
...
feeac0ff2d
2 changed files with 3 additions and 7 deletions
|
@ -1,2 +0,0 @@
|
|||
# `diaryrs`
|
||||
> Overengineered Rust-based diary keeper and processer
|
|
@ -1,9 +1,8 @@
|
|||
mod args;
|
||||
|
||||
use args::{Args, Config};
|
||||
use chrono::Datelike;
|
||||
use clap::Parser;
|
||||
use diaryrs::{macros::UnwrapOrFatalAble, time::Time, util};
|
||||
use diaryrs::{macros::UnwrapOrFatalAble, time::Time};
|
||||
use indoc::formatdoc;
|
||||
use std::fs;
|
||||
use std::io::prelude::*;
|
||||
|
@ -32,15 +31,14 @@ fn main() {
|
|||
let month = time.datetime.format("%m").to_string();
|
||||
let month_name = time.datetime.format("%B").to_string();
|
||||
let day = time.datetime.format("%d").to_string();
|
||||
let day_ordinal = util::ordinal(time.datetime.day());
|
||||
let ymd = format!("{}-{}-{}", year, month, day);
|
||||
|
||||
let dir_path = config
|
||||
.base_path
|
||||
.join(&year)
|
||||
.join(&month_name)
|
||||
.join(&day_ordinal);
|
||||
fs::create_dir_all(&dir_path)
|
||||
.join(&ymd);
|
||||
fs::create_dir_all(&dir_path)
|
||||
.unwrap_or_fatal("Failed to create directory for today's entry");
|
||||
|
||||
// Write entry to file if not exists
|
||||
|
|
Loading…
Reference in a new issue