blob: 742b74be0b0a0f75972f1eb9b072a4645d2a13a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
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) {}
|