Initial commit

This commit is contained in:
2025-09-08 22:59:30 -04:00
commit 689666b522
4 changed files with 562 additions and 0 deletions

48
src/main.rs Normal file
View File

@@ -0,0 +1,48 @@
use chrono::{Datelike, Local};
use clap::{Parser, Subcommand};
use std::env;
use std::process::Command;
#[derive(Parser)]
#[command(author, version, about = "A simple CLI tool example", long_about = None)]
struct Args {
#[command(subcommand)]
command: Option<Commands>,
}
#[derive(Subcommand)]
enum Commands {
/// Greets the specified person
Greet {
/// The name of the person to greet
name: String,
},
/// Performs a simple calculation
Calculate {
/// The first number
num1: i32,
/// The second number
num2: i32,
},
}
fn main() {
let args = Args::parse();
let DAILY_FILEPATH = match env::var("VIMTODAY_DAILY_FILEPATH") {
Ok(val) => val,
Err(_e) => String::from("oops")
};
let today = Local::now();
let today_date_str = format!("{}-{:02}-{:02}", today.year(), today.month(), today.day());
let file_path = format!("{}/{}/{}", &DAILY_FILEPATH, today.year(), &today_date_str);
println!("vim {}", file_path);
Command::new("vim")
.arg(&file_path)
.status()
.expect("process failed to execute");
}