about summary refs log tree commit diff stats
path: root/src/cli.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-03-31 21:57:01 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-03-31 21:57:01 +0200
commit2e5e4b5736c446198e36760e254b7c17dd987166 (patch)
treeb74915864a2c80dbc0a0ebe26a52140a934f45c5 /src/cli.rs
parentdocs(example): Add an example directory (diff)
downloadlpm-2e5e4b5736c446198e36760e254b7c17dd987166.zip
refactor(treewide): Improve code quality by working with a FileTree
The FileTree has been taken from the implementation written by my for the
Trinitrix project. It alleviates the problem, where functions had to do
many things themselves.
Diffstat (limited to '')
-rw-r--r--src/cli.rs (renamed from src/command_line_interface.rs)19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/command_line_interface.rs b/src/cli.rs
index 5d24ae5..fe1b194 100644
--- a/src/command_line_interface.rs
+++ b/src/cli.rs
@@ -2,7 +2,7 @@ use clap::{Parser, Subcommand};
 
 /// A project manager for LaTeX
 #[derive(Parser, Debug)]
-#[clap(author, version, about, long_about = None)]
+#[command(author, version, about, long_about = None)]
 pub struct Args {
     #[command(subcommand)]
     pub cli: Command,
@@ -12,13 +12,17 @@ pub struct Args {
 pub enum Command {
     /// Generates a new part
     #[command(subcommand)]
-    New(SubCommand),
+    New(What),
 }
 
 #[derive(Subcommand, Debug)]
-pub enum SubCommand {
+pub enum What {
     /// Adds a section
     Section {
+        /// The name of the chapter to extend, can be empty when the current_dir is inside a
+        /// chapter already.
+        #[arg(long, short)]
+        chapter: Option<String>,
         /// Name of the new Section
         name: String,
     },
@@ -28,13 +32,4 @@ pub enum SubCommand {
         /// Name of the new Chapter
         name: String,
     },
-    //    /// generates a new project
-    //    Project {
-    //        /// Name of the new Project
-    //        name: String,
-    //        /// Name of the first chapter
-    //        first_chapter: String,
-    //        // /// Name of the first section
-    //        // first_section: String,
-    //    },
 }