Upgrade to clap

This commit is contained in:
Sofia 2024-11-21 23:21:45 +02:00
parent d97d706c52
commit 208432793f
3 changed files with 21 additions and 68 deletions

73
Cargo.lock generated
View File

@ -104,9 +104,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro2 1.0.91", "proc-macro2",
"quote 1.0.37", "quote",
"syn 2.0.89", "syn",
] ]
[[package]] [[package]]
@ -166,15 +166,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3bf70094d203e07844da868b634207e71bfab254fe713171fae9a6e751ccf31" checksum = "a3bf70094d203e07844da868b634207e71bfab254fe713171fae9a6e751ccf31"
[[package]]
name = "proc-macro2"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49b6a521dc81b643e9a51e0d1cf05df46d5a2f3c0280ea72bcb68276ba64a118"
dependencies = [
"unicode-xid",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.91" version = "1.0.91"
@ -194,22 +185,13 @@ dependencies = [
"getopts", "getopts",
] ]
[[package]]
name = "quote"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b0ff51282f28dc1b53fd154298feaa2e77c5ea0dba68e1fd8b03b72fbe13d2a"
dependencies = [
"proc-macro2 0.3.6",
]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.37" version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
dependencies = [ dependencies = [
"proc-macro2 1.0.91", "proc-macro2",
] ]
[[package]] [[package]]
@ -236,30 +218,22 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.38" version = "1.0.215"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c36359ac1a823e00db02a243376ced650f088dc1f6259bbf828e4668e3c7399" checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f"
[[package]]
name = "serde_derive"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0477feff739386f5bca8e13fa43d96a4e834904d538f503906c8179f9205f50"
dependencies = [ dependencies = [
"proc-macro2 0.3.6", "serde_derive",
"quote 0.5.1",
"serde_derive_internals",
"syn 0.13.1",
] ]
[[package]] [[package]]
name = "serde_derive_internals" name = "serde_derive"
version = "0.23.1" version = "1.0.215"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d30c4596450fd7bbda79ef15559683f9a79ac0193ea819db90000d7e1cae794" checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0"
dependencies = [ dependencies = [
"proc-macro2 0.3.6", "proc-macro2",
"syn 0.13.1", "quote",
"syn",
] ]
[[package]] [[package]]
@ -268,25 +242,14 @@ version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91b52877572087400e83d24b9178488541e3d535259e04ff17a63df1e5ceff59"
dependencies = [
"proc-macro2 0.3.6",
"quote 0.5.1",
"unicode-xid",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.89" version = "2.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e"
dependencies = [ dependencies = [
"proc-macro2 1.0.91", "proc-macro2",
"quote 1.0.37", "quote",
"unicode-ident", "unicode-ident",
] ]
@ -335,12 +298,6 @@ version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
[[package]]
name = "unicode-xid"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
[[package]] [[package]]
name = "unreachable" name = "unreachable"
version = "1.0.0" version = "1.0.0"

View File

@ -8,9 +8,9 @@ edition = "2021"
[dependencies] [dependencies]
pulldown-cmark = "*" pulldown-cmark = "*"
toml = "*" toml = "*"
serde = "*"
serde_derive = "*"
regex = "*" regex = "*"
ansi_term = "*" ansi_term = "*"
pathdiff = "*" pathdiff = "*"
clap = { version = "4.5.21", features = ["derive"] } clap = { version = "4.5.21", features = ["derive"] }
serde = "1.0.215"
serde_derive = "1.0.215"

View File

@ -2,15 +2,14 @@ use std::path::PathBuf;
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
// #[structopt(name = "Teasca.de Generator", /// A website generator, used mainly for generating teascade.net
// about = "A website generator, used mainly for generating teasca.de")]
/// Hello!
#[derive(Parser, Debug, Clone)] #[derive(Parser, Debug, Clone)]
#[command(version, about, long_about = None)] #[command(version, about, long_about = None)]
pub struct Options { pub struct Options {
/// verbose flag, makes the program more noisy. (-vv for maximum noisiness) /// verbose flag, makes the program more noisy. (-vv for maximum noisiness)
#[arg(short, long, action = clap::ArgAction::Count)] #[arg(short, long, action = clap::ArgAction::Count)]
pub verbose: u8, pub verbose: u8,
/// quiet flag, makes the program less noisy. (-qqq for minimum noisiness) /// quiet flag, makes the program less noisy. (-qqq for minimum noisiness)
#[arg(short, long, action = clap::ArgAction::Count)] #[arg(short, long, action = clap::ArgAction::Count)]
pub quiet: u8, pub quiet: u8,
@ -34,8 +33,6 @@ pub enum Subcommands {
Initialize(InitializeOpt), Initialize(InitializeOpt),
} }
/// beep
// #[argh(subcommand, name = "new")]
#[derive(Parser, Debug, Clone)] #[derive(Parser, Debug, Clone)]
#[clap(disable_help_flag = true)] #[clap(disable_help_flag = true)]
pub struct NewOpt { pub struct NewOpt {
@ -47,11 +44,11 @@ pub struct NewOpt {
/// file path for the markdown file created /// file path for the markdown file created
#[arg(long = "markdown", short)] #[arg(long = "markdown", short)]
pub markdown_path: Option<PathBuf>, // TODO, should be 'markdown' pub markdown_path: Option<PathBuf>,
/// output html file path of the generated page /// output html file path of the generated page
#[arg(long = "html", short)] #[arg(long = "html", short)]
pub html_path: Option<PathBuf>, // TODO, should be 'html' pub html_path: Option<PathBuf>,
/// sets the title of the generated page /// sets the title of the generated page
#[arg(short, long)] #[arg(short, long)]
@ -62,7 +59,6 @@ pub struct NewOpt {
pub no_modify_config: bool, pub no_modify_config: bool,
} }
/// beep
#[derive(Parser, Debug, Clone)] #[derive(Parser, Debug, Clone)]
pub struct InitializeOpt { pub struct InitializeOpt {
/// name of the webpage /// name of the webpage