Remove the AddPost command.
I will be putting this back in later but having the skeleton sitting there unused has no value at this time.
This commit is contained in:
parent
273734c9ff
commit
051e86e65a
@ -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::*;
|
||||
|
@ -0,0 +1,3 @@
|
||||
mod runner;
|
||||
|
||||
pub(crate) use runner::build_site;
|
7
src/command/build/runner.rs
Normal file
7
src/command/build/runner.rs
Normal file
@ -0,0 +1,7 @@
|
||||
use crate::cli::parameters::BuildArgs;
|
||||
use crate::config::Config;
|
||||
|
||||
pub(crate) async fn build_site(args: BuildArgs) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let _config = Config::load_from_file(args.config).await?;
|
||||
Ok(())
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
use crate::cli::parameters::InitArgs;
|
||||
use crate::config::Config;
|
||||
|
||||
pub(crate) async fn init_writer_folder(args: &InitArgs) -> Result<(), Box<dyn std::error::Error>> {
|
||||
pub(crate) async fn init_writer_folder(args: InitArgs) -> Result<(), Box<dyn std::error::Error>> {
|
||||
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<dyn st
|
||||
return Err("The directory is not empty. Aborting.".into());
|
||||
}
|
||||
|
||||
let new_config = Config::new(&args.path)?;
|
||||
let new_config = Config::new(args.path)?;
|
||||
new_config.write_to_disk().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ use clap::Parser;
|
||||
|
||||
use self::cli::parameters::Cli;
|
||||
use self::cli::parameters::Commands;
|
||||
use self::command::build::build_site;
|
||||
use self::command::init::init_writer_folder;
|
||||
mod cli;
|
||||
mod command;
|
||||
@ -21,10 +22,11 @@ async fn main_body() -> Result<ExitCode, Box<dyn std::error::Error>> {
|
||||
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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user