diff options
| author | magnusrodseth <59113973+magnusrodseth@users.noreply.github.com> | 2022-08-17 16:31:53 +0200 |
|---|---|---|
| committer | magnusrodseth <59113973+magnusrodseth@users.noreply.github.com> | 2022-08-17 16:31:53 +0200 |
| commit | 6f44cb1dd237f4d53aa3ecd4676e50cf850c99fe (patch) | |
| tree | cd74cefb493ec715c13b4f0bdb0bc47c9bd0cf98 /src/run.rs | |
| parent | d0c7b06eff3e8959b261145e10f1aaa57ba1e4c3 (diff) | |
feat: Add reset command, given a filename
Diffstat (limited to 'src/run.rs')
| -rw-r--r-- | src/run.rs | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -1,3 +1,5 @@ +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 |
