My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nomicon/apps/koffice/invoice/src/main.rs

41 lines
965 B

mod base;
mod cli;
mod pfile;
pub(crate) use base::*;
pub(crate) use cli::*;
pub(crate) use pfile::*;
use libko::*;
use std::{io::Write, fs::OpenOptions as Oo};
fn main() {
let AppState { meta, cmd } = cli::parse();
match cmd {
Command::Init => init(meta),
Command::Generate => generate(meta),
Command::Install => todo!(),
}
}
fn init(meta: Meta) {
let pid = meta.project_id.as_ref().unwrap_or_else(|| {
meta.timefile
.as_ref()
.expect("No project id given, with no timefile available")
.client()
.as_ref()
.unwrap()
});
let path = meta.invoice_dir.join(pid);
let mut f = Oo::new().write(true).truncate(true).open(path).unwrap();
f.write_all(pfile::data_templ().as_bytes()).unwrap();
// let pid = meta.project_id.as_ref().unwrap_or_else(||
// let f = meta.invoice_dir.join(meta.project_id);
}
fn generate(meta: Meta) {}