use std::fmt::Display; use clap::{Parser, Subcommand, ValueEnum}; use crate::word_representation::Penalty; #[derive(Parser, Debug)] #[command(version, about, long_about = None)] pub(crate) struct Args { #[command(subcommand)] pub(crate) command: Commands, #[arg(long, short, value_enum, default_value_t=Wordtypes::Full)] pub(crate) wordlist: Wordtypes, /// Duplicate letters are set to this value #[arg(short, long)] pub(crate) set: isize, /// Duplicate letters instead decrease the value by this amount #[arg(short, long)] pub(crate) sub: isize, } #[derive(Subcommand, Debug)] pub(crate) enum Commands { /// Tools to solve the wordle Solve { /// Contains these letters #[arg(short, long)] r#in: Option, /// Has these position, as a regex, use ^start, end$ and wor.d extensively #[arg(short, long)] pos: Option, /// Doesnt contains these letters #[arg(short, long)] out: Option, }, /// Tools to calculate best words for a wordle List { /// Number of guesses targetted #[arg(short, long)] number: Option, /// How many branches to try, warning exponential solving time #[arg(short, long, default_value_t = 5)] depth: usize, /// Solving algorithm #[arg(short, long, value_enum, default_value_t = AlgoType::Best)] algo: AlgoType, }, } /// The word list to use #[derive(ValueEnum, Debug, Clone)] pub(crate) enum Wordtypes { /// A simplified list of words, more likely to appear in the wordle Simple, /// The full list of words legal in wordle Full, // /// Mixed word list, picks a simpler list for weights and full for coverage // Mixed, } /// The word list to use #[derive(ValueEnum, Debug, Clone)] pub(crate) enum AlgoType { /// Best candidate algorithm Best, /// Full candidate list Full, } impl Display for AlgoType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { AlgoType::Best => f.write_str("Best"), AlgoType::Full => f.write_str("Full"), } } }