added commands for features
This commit is contained in:
14
src/main.rs
14
src/main.rs
@@ -12,7 +12,8 @@ struct Cli {
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum Commands {
|
||||
CorrectWord(WordArgs)
|
||||
CorrectWord(WordArgs),
|
||||
CorrectFile(FileArgs)
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
@@ -22,6 +23,14 @@ struct WordArgs {
|
||||
list_path: String
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
struct FileArgs {
|
||||
#[arg(short,long)]
|
||||
input: String,
|
||||
list_path: String,
|
||||
output: String
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let cli: Cli = Cli::parse();
|
||||
|
||||
@@ -29,6 +38,9 @@ fn main() {
|
||||
Commands::CorrectWord(args) => {
|
||||
let out: String = utils::correct(args.input.clone(), args.list_path.clone());
|
||||
println!("{}", out);
|
||||
},
|
||||
Commands::CorrectFile(args) => {
|
||||
utils::correct_file(args.input.clone(), args.list_path.clone(), args.output.clone())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user