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;
|
mod args;
|
||||||
|
|
||||||
use args::{Args, Config};
|
use args::{Args, Config};
|
||||||
use chrono::Datelike;
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use diaryrs::{macros::UnwrapOrFatalAble, time::Time, util};
|
use diaryrs::{macros::UnwrapOrFatalAble, time::Time};
|
||||||
use indoc::formatdoc;
|
use indoc::formatdoc;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
|
@ -32,14 +31,13 @@ fn main() {
|
||||||
let month = time.datetime.format("%m").to_string();
|
let month = time.datetime.format("%m").to_string();
|
||||||
let month_name = time.datetime.format("%B").to_string();
|
let month_name = time.datetime.format("%B").to_string();
|
||||||
let day = time.datetime.format("%d").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 ymd = format!("{}-{}-{}", year, month, day);
|
||||||
|
|
||||||
let dir_path = config
|
let dir_path = config
|
||||||
.base_path
|
.base_path
|
||||||
.join(&year)
|
.join(&year)
|
||||||
.join(&month_name)
|
.join(&month_name)
|
||||||
.join(&day_ordinal);
|
.join(&ymd);
|
||||||
fs::create_dir_all(&dir_path)
|
fs::create_dir_all(&dir_path)
|
||||||
.unwrap_or_fatal("Failed to create directory for today's entry");
|
.unwrap_or_fatal("Failed to create directory for today's entry");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue