initial commit
This commit is contained in:
34
src/main.rs
Normal file
34
src/main.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
use clap::{Args, Parser, Subcommand};
|
||||
use text_correction::utils;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(name = "german word corrector")]
|
||||
#[command(version, about, long_about = None)]
|
||||
#[command(next_line_help = true)]
|
||||
struct Cli {
|
||||
#[command(subcommand)]
|
||||
command: Commands
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum Commands {
|
||||
CorrectWord(WordArgs)
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
struct WordArgs {
|
||||
#[arg(short,long)]
|
||||
input: String,
|
||||
list_path: String
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let cli: Cli = Cli::parse();
|
||||
|
||||
match &cli.command {
|
||||
Commands::CorrectWord(args) => {
|
||||
let out: String = utils::correct(args.input.clone(), args.list_path.clone());
|
||||
println!("{}", out);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user