diff --git a/src/cli/parameters.rs b/src/cli/parameters.rs index 008a384..d5551fb 100644 --- a/src/cli/parameters.rs +++ b/src/cli/parameters.rs @@ -20,9 +20,6 @@ pub(crate) enum Commands { /// Build the static site. Build(BuildArgs), - - /// Add a blog post to the site. - AddPost(BuildArgs), } #[derive(Args, Debug)] @@ -39,13 +36,6 @@ pub(crate) struct BuildArgs { pub(crate) config: PathBuf, } -#[derive(Args, Debug)] -pub(crate) struct AddPostArgs { - /// Path to the writer config file. - #[arg(short, long)] - pub(crate) config: PathBuf, -} - #[cfg(test)] mod tests { use super::*; diff --git a/src/command/build/mod.rs b/src/command/build/mod.rs index e69de29..2b7c076 100644 --- a/src/command/build/mod.rs +++ b/src/command/build/mod.rs @@ -0,0 +1,3 @@ +mod runner; + +pub(crate) use runner::build_site; diff --git a/src/command/build/runner.rs b/src/command/build/runner.rs new file mode 100644 index 0000000..c9183a3 --- /dev/null +++ b/src/command/build/runner.rs @@ -0,0 +1,7 @@ +use crate::cli::parameters::BuildArgs; +use crate::config::Config; + +pub(crate) async fn build_site(args: BuildArgs) -> Result<(), Box> { + let _config = Config::load_from_file(args.config).await?; + Ok(()) +} diff --git a/src/command/init/runner.rs b/src/command/init/runner.rs index 74cd176..976f7a2 100644 --- a/src/command/init/runner.rs +++ b/src/command/init/runner.rs @@ -1,7 +1,7 @@ use crate::cli::parameters::InitArgs; use crate::config::Config; -pub(crate) async fn init_writer_folder(args: &InitArgs) -> Result<(), Box> { +pub(crate) async fn init_writer_folder(args: InitArgs) -> Result<(), Box> { if args.path.exists() && !args.path.is_dir() { return Err("The supplied path exists but is not a directory. Aborting.".into()); } @@ -16,7 +16,7 @@ pub(crate) async fn init_writer_folder(args: &InitArgs) -> Result<(), Box Result> { let args = Cli::parse(); match args.command { Commands::Init(args) => { - init_writer_folder(&args).await?; + init_writer_folder(args).await?; + } + Commands::Build(args) => { + build_site(args).await?; } - Commands::Build(_args) => {} - Commands::AddPost(_args) => {} }; Ok(ExitCode::SUCCESS) }