summary refs log tree commit diff stats
path: root/src/main.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-09-29 11:48:59 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-09-29 11:49:13 +0200
commit800ffaf658c3defe165dd24c3ecd65ceabc7096a (patch)
treeb9b2e44ac8a73efecdba3ac65be4ebb0dd20e239 /src/main.rs
parentfix(MangledName): Also replace `"` and `'` (diff)
downloadlpm-800ffaf658c3defe165dd24c3ecd65ceabc7096a.tar.gz
lpm-800ffaf658c3defe165dd24c3ecd65ceabc7096a.zip
feat(new/figure)!: Init
BREAKING CHANGE: The config file now needs to contain an
                 `templates.figure` key. You can simply add this.
Diffstat (limited to '')
-rw-r--r--src/main.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/main.rs b/src/main.rs
index ce886bf..a8c5a4a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2,14 +2,12 @@ use std::{env, ffi::OsString, fs, path::PathBuf};
 
 use anyhow::{bail, Context};
 use clap::Parser;
-use cli::Command;
+use cli::{Command, What};
 use log::debug;
+use new::figure::generate_new_figure;
 
 use crate::{
-    cli::{
-        Args,
-        What::{Chapter, Section},
-    },
+    cli::Args,
     config_file::Config,
     new::{chapter::generate_new_chapter, section::generate_new_section},
 };
@@ -17,8 +15,8 @@ use crate::{
 pub mod bundle;
 pub mod cli;
 pub mod config_file;
-pub mod new;
 pub mod constants;
+pub mod new;
 
 // The copyright header tells you, where this file is from.
 pub mod file_tree;
@@ -48,9 +46,9 @@ fn main() -> anyhow::Result<()> {
             None
         }
         Command::New(new_command) => match new_command {
-            Section { name, chapter } => {
+            What::Section { name, chapter } => {
                 let chapter = if let Some(val) = chapter {
-                    // The user probably has not added the preceeding chapter number to the chapter
+                    // The user probably has not added the preceding chapter number to the chapter
                     // string
                     if val.starts_with(|c: char| c.is_numeric()) {
                         eprintln!(
@@ -76,7 +74,8 @@ fn main() -> anyhow::Result<()> {
                     &chapter,
                 )?)
             }
-            Chapter { name } => Some(generate_new_chapter(config, &project_root, name)?),
+            What::Chapter { name } => Some(generate_new_chapter(config, &project_root, name)?),
+            What::Figure { name } => Some(generate_new_figure(&config, name, &project_root)?),
         },
     };