From 615946c8bb61ac7780c6d9a4530fbdbc32ad68e5 Mon Sep 17 00:00:00 2001 From: William G Underwood <42812654+WGUNDERWOOD@users.noreply.github.com> Date: Fri, 3 May 2024 18:36:17 -0400 Subject: [PATCH] Adding new file for parsing code --- notes.org | 5 +---- src/main.rs | 16 ++-------------- src/parse.rs | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 src/parse.rs diff --git a/notes.org b/notes.org index 2fa35c6..68324bb 100644 --- a/notes.org +++ b/notes.org @@ -11,14 +11,11 @@ ** Ignore source lines *** Line-by-line ignore *** Block ignore -** Tests should compile to same pdf ** Documentation ** Tidy up code ** Find todos -** Clippy -** New source files: write.rs, parse.rs, print.rs +** New source files: write.rs, print.rs ** Tests better output * Bugs ** Better errors including line numbers in source file ** Handle list items properly -* Structure diff --git a/src/main.rs b/src/main.rs index baa78bb..c08bc79 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,27 +9,15 @@ const YELLOW: &str = "\x1b[33m\x1b[1m"; const PINK: &str = "\x1b[35m\x1b[1m"; const RESET: &str = "\x1b[00m\x1b[0m"; -#[derive(Parser)] -struct Cli { - #[arg(long, short, help = "Print to stdout, do not modify files")] - print: bool, - #[arg( - long, - short, - help = "Debug mode, disable checks and do not modify files" - )] - debug: bool, - #[arg(required = true)] - filenames: Vec, -} - mod comments; mod format; mod indent; +mod parse; mod regexes; mod subs; mod wrap; use crate::format::*; +use crate::parse::Cli; #[cfg(test)] mod tests; diff --git a/src/parse.rs b/src/parse.rs new file mode 100644 index 0000000..a554bc2 --- /dev/null +++ b/src/parse.rs @@ -0,0 +1,16 @@ +use crate::Parser; + +#[derive(Parser)] +pub struct Cli { + #[arg(long, short, help = "Print to stdout, do not modify files")] + pub print: bool, + #[arg( + long, + short, + help = "Debug mode, disable checks and do not modify files" + )] + pub debug: bool, + #[arg(required = true)] + pub filenames: Vec, +} +