From 2e5e4b5736c446198e36760e254b7c17dd987166 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sun, 31 Mar 2024 21:57:01 +0200 Subject: 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. --- src/cli.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/cli.rs (limited to 'src/cli.rs') diff --git a/src/cli.rs b/src/cli.rs new file mode 100644 index 0000000..fe1b194 --- /dev/null +++ b/src/cli.rs @@ -0,0 +1,35 @@ +use clap::{Parser, Subcommand}; + +/// A project manager for LaTeX +#[derive(Parser, Debug)] +#[command(author, version, about, long_about = None)] +pub struct Args { + #[command(subcommand)] + pub cli: Command, +} + +#[derive(Subcommand, Debug)] +pub enum Command { + /// Generates a new part + #[command(subcommand)] + New(What), +} + +#[derive(Subcommand, Debug)] +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, + /// Name of the new Section + name: String, + }, + + /// Adds a chapter + Chapter { + /// Name of the new Chapter + name: String, + }, +} -- cgit 1.4.1