From a9867f073bb47f5795176725f40b7bbf0d7bd5e2 Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L. de Mello" Date: Thu, 28 Mar 2024 17:33:22 -0300 Subject: [PATCH] feat: convert command and module --- src/convert.rs | 5 +++++ src/lib.rs | 1 + src/main.rs | 8 ++++++++ 3 files changed, 14 insertions(+) create mode 100644 src/convert.rs diff --git a/src/convert.rs b/src/convert.rs new file mode 100644 index 0000000..d7bf5a8 --- /dev/null +++ b/src/convert.rs @@ -0,0 +1,5 @@ +#[derive(clap::ValueEnum, Clone, Debug)] +pub enum Formats { + TumblrNPF, +} + diff --git a/src/lib.rs b/src/lib.rs index 2fcb630..4986262 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,4 @@ +pub mod convert; pub mod frontmatter; pub mod links; pub mod utils; diff --git a/src/main.rs b/src/main.rs index 39852de..64eefbf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,6 +5,7 @@ use clio::*; use comrak::nodes::NodeValue; use mdparser::{ + convert, frontmatter::{self, Frontmatter}, links, utils, }; @@ -48,6 +49,10 @@ enum Commands { command: FrontmatterCommands, }, Not {}, + Convert { + #[arg(short, long)] + format: convert::Formats, + }, } #[derive(Debug, Subcommand)] @@ -81,6 +86,9 @@ fn main() { let arena = comrak::Arena::new(); let ast = comrak::parse_document(&arena, &file, &mdparser::utils::default_options()); + if let Commands::Convert { format } = &cli.command { + return; + } match &cli.command { Commands::Links { path_root,