natter/src/cli/parameters.rs

49 lines
1.0 KiB
Rust
Raw Permalink Normal View History

2023-10-18 23:47:05 +00:00
use clap::Args;
use clap::Parser;
use clap::Subcommand;
use std::path::PathBuf;
#[derive(Parser, Debug)]
2023-12-22 00:28:31 +00:00
#[command(name = "Natter")]
2023-10-18 23:47:05 +00:00
#[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),
}
#[derive(Args, Debug)]
pub(crate) struct InitArgs {
2023-12-22 00:28:31 +00:00
/// Path where you want the initial natter structure to be located.
2023-10-18 23:47:05 +00:00
#[arg(short, long)]
pub(crate) path: PathBuf,
}
#[derive(Args, Debug)]
pub(crate) struct BuildArgs {
2023-12-22 00:28:31 +00:00
/// Path to the natter config file.
2023-10-18 23:47:05 +00:00
#[arg(short, long)]
pub(crate) config: PathBuf,
}
2023-10-18 23:49:03 +00:00
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn verify_cli() {
use clap::CommandFactory;
Cli::command().debug_assert()
}
}