feat: Add reset command, given a filename
+use std::process::Command;
+
use crate::exercise::{Exercise, Mode};
use crate::verify::test;
use indicatif::ProgressBar;
@@ -15,6 +17,19 @@ pub fn run(exercise: &Exercise, verbose: bool) -> Result<(), ()> {
Ok(())
}
+// Resets the exercise by stashing the changes.
+pub fn reset(exercise: &Exercise) -> Result<(), ()> {
+ let command = Command::new("git")
+ .args(["stash", "--"])
+ .arg(&exercise.path)
+ .spawn();
+
+ match command {
+ Ok(_) => Ok(()),
+ Err(_) => Err(()),
+ }
+}
+
// Invoke the rust compiler on the path of the given exercise
// and run the ensuing binary.
// This is strictly for non-test binaries, so output is displayed
