Skip to content

Commit c44e302

Browse files
committed
option success_hints added to the struct Watchargs instead of Args
1 parent 5d3696a commit c44e302

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/main.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ struct Args {
3737
/// show the executable version
3838
#[argh(switch, short = 'v')]
3939
version: bool,
40-
/// show hints on success
41-
#[argh(switch)]
42-
success_hints: bool,
4340
#[argh(subcommand)]
4441
nested: Option<Subcommands>,
4542
}
@@ -64,7 +61,11 @@ struct VerifyArgs {}
6461
#[derive(FromArgs, PartialEq, Debug)]
6562
#[argh(subcommand, name = "watch")]
6663
/// Reruns `verify` when files were edited
67-
struct WatchArgs {}
64+
struct WatchArgs {
65+
/// show hints on success
66+
#[argh(switch)]
67+
success_hints: bool,
68+
}
6869

6970
#[derive(FromArgs, PartialEq, Debug)]
7071
#[argh(subcommand, name = "run")]
@@ -151,7 +152,6 @@ fn main() {
151152
let toml_str = &fs::read_to_string("info.toml").unwrap();
152153
let exercises = toml::from_str::<ExerciseList>(toml_str).unwrap().exercises;
153154
let verbose = args.nocapture;
154-
let success_hints = args.success_hints;
155155

156156
let command = args.nested.unwrap_or_else(|| {
157157
println!("{DEFAULT_OUT}\n");
@@ -233,7 +233,7 @@ fn main() {
233233
}
234234

235235
Subcommands::Verify(_subargs) => {
236-
verify(&exercises, (0, exercises.len()), verbose, success_hints)
236+
verify(&exercises, (0, exercises.len()), verbose, false)
237237
.unwrap_or_else(|_| std::process::exit(1));
238238
}
239239

@@ -256,7 +256,7 @@ fn main() {
256256
}
257257
}
258258

259-
Subcommands::Watch(_subargs) => match watch(&exercises, verbose, success_hints) {
259+
Subcommands::Watch(_subargs) => match watch(&exercises, verbose, _subargs.success_hints) {
260260
Err(e) => {
261261
println!(
262262
"Error: Could not watch your progress. Error message was {:?}.",

0 commit comments

Comments
 (0)