2018-04-16 19:03:33 +02:00
|
|
|
use std::path::PathBuf;
|
|
|
|
|
2018-04-18 20:06:02 +02:00
|
|
|
#[derive(StructOpt, Debug, Clone)]
|
2018-04-16 18:31:38 +02:00
|
|
|
#[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,
|
|
|
|
|
2018-04-18 20:06:02 +02:00
|
|
|
/// Overwrites necessary files to create new ones.
|
|
|
|
#[structopt(short = "o", long = "overwrite")]
|
|
|
|
pub overwrite: bool,
|
|
|
|
|
2018-04-16 18:31:38 +02:00
|
|
|
#[structopt(subcommand)]
|
|
|
|
pub cmd: Subcommands,
|
|
|
|
}
|
|
|
|
|
2018-04-18 20:06:02 +02:00
|
|
|
#[derive(StructOpt, Debug, Clone)]
|
2018-04-16 18:31:38 +02:00
|
|
|
pub enum Subcommands {
|
|
|
|
/// Build the website
|
|
|
|
#[structopt(name = "build")]
|
2018-04-18 20:06:02 +02:00
|
|
|
Build(BuildOpt),
|
2018-04-16 18:31:38 +02:00
|
|
|
/// Create a new page
|
2018-04-16 19:03:33 +02:00
|
|
|
#[structopt(name = "new")]
|
2018-04-18 20:06:02 +02:00
|
|
|
New(NewOpt),
|
2018-04-17 00:17:47 +02:00
|
|
|
/// Initializes a config.toml
|
|
|
|
#[structopt(name = "init")]
|
2018-04-18 20:06:02 +02:00
|
|
|
Initialize(InitializeOpt),
|
2018-04-16 18:31:38 +02:00
|
|
|
}
|
|
|
|
|
2018-04-18 20:06:02 +02:00
|
|
|
#[derive(StructOpt, Debug, Clone)]
|
|
|
|
pub struct BuildOpt {}
|
2018-04-16 19:03:33 +02:00
|
|
|
|
2018-04-18 20:06:02 +02:00
|
|
|
#[derive(StructOpt, Debug, Clone)]
|
|
|
|
pub struct NewOpt {
|
2018-04-16 19:03:33 +02:00
|
|
|
/// File path for the .toml file created
|
|
|
|
#[structopt(parse(from_os_str))]
|
|
|
|
pub toml_path: PathBuf,
|
2018-04-18 20:06:02 +02:00
|
|
|
|
2018-04-16 19:03:33 +02:00
|
|
|
/// File path for the markdown file created
|
|
|
|
#[structopt(short = "m", long = "markdown", parse(from_os_str))]
|
|
|
|
pub markdown_path: Option<PathBuf>,
|
2018-04-18 20:06:02 +02:00
|
|
|
|
2018-04-16 23:31:44 +02:00
|
|
|
/// Outpuh html file path of the generated page
|
|
|
|
#[structopt(short = "h", long = "html", parse(from_os_str))]
|
|
|
|
pub html_path: Option<PathBuf>,
|
2018-04-18 20:06:02 +02:00
|
|
|
|
2018-04-16 23:31:44 +02:00
|
|
|
/// Sets the title of the generated page
|
|
|
|
#[structopt(short = "t", long = "title")]
|
|
|
|
pub title: Option<String>,
|
2018-04-18 20:06:02 +02:00
|
|
|
|
2018-04-16 23:50:28 +02:00
|
|
|
/// Don't modify config.toml automatically
|
|
|
|
#[structopt(short = "n", long = "no-modify-config")]
|
|
|
|
pub no_modify_config: bool,
|
2018-04-16 19:03:33 +02:00
|
|
|
}
|
2018-04-17 00:17:47 +02:00
|
|
|
|
2018-04-18 20:06:02 +02:00
|
|
|
#[derive(StructOpt, Debug, Clone)]
|
|
|
|
pub struct InitializeOpt {
|
2018-04-17 00:17:47 +02:00
|
|
|
/// Name of the webpage
|
|
|
|
#[structopt()]
|
|
|
|
pub name: String,
|
2018-04-18 20:06:02 +02:00
|
|
|
|
2018-04-17 00:17:47 +02:00
|
|
|
/// Favicon
|
|
|
|
#[structopt(short = "f", long = "favicon")]
|
|
|
|
pub favicon: Option<String>,
|
2018-04-18 20:06:02 +02:00
|
|
|
|
2018-04-17 00:17:47 +02:00
|
|
|
/// Twitter author
|
|
|
|
#[structopt(short = "t", long = "twitter")]
|
|
|
|
pub twitter_author: Option<String>,
|
2018-04-18 20:06:02 +02:00
|
|
|
|
2018-04-17 00:17:47 +02:00
|
|
|
/// Disables the default navbar
|
|
|
|
#[structopt(short = "n", long = "no-navbar")]
|
|
|
|
pub no_default_navbar: bool,
|
|
|
|
}
|