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 the static site.
|
||||||
Build(BuildArgs),
|
Build(BuildArgs),
|
||||||
|
|
||||||
/// Add a blog post to the site.
|
|
||||||
AddPost(BuildArgs),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Args, Debug)]
|
#[derive(Args, Debug)]
|
||||||
@ -39,13 +36,6 @@ pub(crate) struct BuildArgs {
|
|||||||
pub(crate) config: PathBuf,
|
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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
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::cli::parameters::InitArgs;
|
||||||
use crate::config::Config;
|
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() {
|
if args.path.exists() && !args.path.is_dir() {
|
||||||
return Err("The supplied path exists but is not a directory. Aborting.".into());
|
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());
|
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?;
|
new_config.write_to_disk().await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ use clap::Parser;
|
|||||||
|
|
||||||
use self::cli::parameters::Cli;
|
use self::cli::parameters::Cli;
|
||||||
use self::cli::parameters::Commands;
|
use self::cli::parameters::Commands;
|
||||||
|
use self::command::build::build_site;
|
||||||
use self::command::init::init_writer_folder;
|
use self::command::init::init_writer_folder;
|
||||||
mod cli;
|
mod cli;
|
||||||
mod command;
|
mod command;
|
||||||
@ -21,10 +22,11 @@ async fn main_body() -> Result<ExitCode, Box<dyn std::error::Error>> {
|
|||||||
let args = Cli::parse();
|
let args = Cli::parse();
|
||||||
match args.command {
|
match args.command {
|
||||||
Commands::Init(args) => {
|
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)
|
Ok(ExitCode::SUCCESS)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user