summary refs log tree commit diff stats
path: root/src/main.rs
diff options
context:
space:
mode:
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)?),
         },
     };