54 lines
1.7 KiB
Rust
54 lines
1.7 KiB
Rust
use std::path::PathBuf;
|
|
|
|
#[derive(StructOpt, Debug)]
|
|
#[structopt(name = "Teasca.de Generator",
|
|
about = "A website generator, used mainly for generating teasca.de")]
|
|
pub struct Opt {
|
|
/// Verbose flag, makes the program more noisy. (-vv for maximum noisiness)
|
|
#[structopt(short = "v", long = "verbose", parse(from_occurrences))]
|
|
pub verbose: u8,
|
|
|
|
/// Quiet flag, makes the program less noisy. (-qqq for minimum noisiness)
|
|
#[structopt(short = "q", long = "quiet", parse(from_occurrences))]
|
|
pub quiet: u8,
|
|
|
|
#[structopt(subcommand)]
|
|
pub cmd: Subcommands,
|
|
}
|
|
|
|
#[derive(StructOpt, Debug)]
|
|
pub enum Subcommands {
|
|
/// Build the website
|
|
#[structopt(name = "build")]
|
|
Build(BuildOps),
|
|
/// Create a new page
|
|
#[structopt(name = "new")]
|
|
New(NewOps),
|
|
}
|
|
|
|
#[derive(StructOpt, Debug)]
|
|
pub struct BuildOps {
|
|
/// Overwrites necessary files to create new ones.
|
|
#[structopt(short = "o", long = "overwrite")]
|
|
pub overwrite: bool,
|
|
}
|
|
|
|
#[derive(StructOpt, Debug)]
|
|
pub struct NewOps {
|
|
/// File path for the .toml file created
|
|
#[structopt(parse(from_os_str))]
|
|
pub toml_path: PathBuf,
|
|
/// File path for the markdown file created
|
|
#[structopt(short = "m", long = "markdown", parse(from_os_str))]
|
|
pub markdown_path: Option<PathBuf>,
|
|
/// Outpuh html file path of the generated page
|
|
#[structopt(short = "h", long = "html", parse(from_os_str))]
|
|
pub html_path: Option<PathBuf>,
|
|
/// Sets the title of the generated page
|
|
#[structopt(short = "t", long = "title")]
|
|
pub title: Option<String>,
|
|
/// Overwrites existing .toml / .md files
|
|
#[structopt(short = "o", long = "overwrite")]
|
|
pub overwrite: bool,
|
|
}
|