48 lines
1.1 KiB
Rust
48 lines
1.1 KiB
Rust
|
use clap::Args;
|
||
|
use clap::Parser;
|
||
|
use clap::Subcommand;
|
||
|
use std::path::PathBuf;
|
||
|
|
||
|
#[derive(Parser, Debug)]
|
||
|
#[command(name = "Writer")]
|
||
|
#[command(version = env!("CARGO_PKG_VERSION"))]
|
||
|
#[command(about = "Generate a static site.", long_about = None)]
|
||
|
#[command(propagate_version = true)]
|
||
|
pub(crate) struct Cli {
|
||
|
#[command(subcommand)]
|
||
|
pub(crate) command: Commands,
|
||
|
}
|
||
|
|
||
|
#[derive(Subcommand, Debug)]
|
||
|
pub(crate) enum Commands {
|
||
|
/// Initialize an empty website folder.
|
||
|
Init(InitArgs),
|
||
|
|
||
|
/// Build the static site.
|
||
|
Build(BuildArgs),
|
||
|
|
||
|
/// Add a blog post to the site.
|
||
|
AddPost(BuildArgs),
|
||
|
}
|
||
|
|
||
|
#[derive(Args, Debug)]
|
||
|
pub(crate) struct InitArgs {
|
||
|
/// Path where you want the initial writer structure to be located.
|
||
|
#[arg(short, long)]
|
||
|
pub(crate) path: PathBuf,
|
||
|
}
|
||
|
|
||
|
#[derive(Args, Debug)]
|
||
|
pub(crate) struct BuildArgs {
|
||
|
/// Path to the writer config file.
|
||
|
#[arg(short, long)]
|
||
|
pub(crate) config: PathBuf,
|
||
|
}
|
||
|
|
||
|
#[derive(Args, Debug)]
|
||
|
pub(crate) struct AddPostArgs {
|
||
|
/// Path to the writer config file.
|
||
|
#[arg(short, long)]
|
||
|
pub(crate) config: PathBuf,
|
||
|
}
|