From 369bf07cbb36d8e72025014bfd4ddc52d9049fde Mon Sep 17 00:00:00 2001 From: Soispha Date: Sun, 18 Jun 2023 16:32:47 +0200 Subject: Chore: Initial commit --- src/main.rs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/main.rs (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..b056c88 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,40 @@ +use std::path::PathBuf; + +use clap::Parser; +use command_line_interface::{ + Args, + Command::New, + SubCommand::{Chapter, Project, Section}, +}; +use new::{chapter::generate_new_chapter, project::generate_new_project, section::generate_new_section}; + +pub mod command_line_interface; +pub mod data; +pub mod new; + +fn main() { + let args = Args::parse(); + + match args.cli { + New(new_command) => match new_command { + Section { name } => generate_new_section(name).unwrap(), + Chapter { name } => generate_new_chapter(name).unwrap(), + Project { + name, + first_chapter, + //first_section, + } => { + let preamble_path = PathBuf::from("/home/dt/repos/tex/preset/headers/preamble.tex"); + let resource_path = PathBuf::from("/home/dt/repos/tex/preset/resources"); + generate_new_project( + name, + first_chapter, + //first_section, + preamble_path, + resource_path, + ) + .unwrap() + } + }, + } +} -- cgit 1.4.1