summaryrefslogtreecommitdiff
path: root/src/exercise.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/exercise.rs')
-rw-r--r--src/exercise.rs38
1 files changed, 3 insertions, 35 deletions
diff --git a/src/exercise.rs b/src/exercise.rs
index 7f924f9..eb7b725 100644
--- a/src/exercise.rs
+++ b/src/exercise.rs
@@ -1,17 +1,13 @@
-use anyhow::{bail, Context, Result};
+use anyhow::{Context, Result};
use crossterm::style::{style, StyledContent, Stylize};
use std::{
fmt::{self, Display, Formatter},
fs,
path::Path,
- process::{Command, Output, Stdio},
+ process::{Command, Output},
};
-use crate::{
- embedded::{WriteStrategy, EMBEDDED_FILES},
- info_file::Mode,
- DEVELOPING_OFFICIAL_RUSTLINGS,
-};
+use crate::{info_file::Mode, DEVELOPING_OFFICIAL_RUSTLINGS};
pub struct TerminalFileLink<'a> {
path: &'a str,
@@ -87,34 +83,6 @@ impl Exercise {
}
}
- pub fn reset(&self) -> Result<()> {
- if Path::new("info.toml").exists() {
- let output = Command::new("git")
- .arg("stash")
- .arg("push")
- .arg("--")
- .arg(self.path)
- .stdin(Stdio::null())
- .stdout(Stdio::null())
- .output()
- .with_context(|| format!("Failed to run `git stash push -- {}`", self.path))?;
-
- if !output.status.success() {
- bail!(
- "`git stash push -- {}` didn't run successfully: {}",
- self.path,
- String::from_utf8_lossy(&output.stderr),
- );
- }
- } else {
- EMBEDDED_FILES
- .write_exercise_to_disk(self.path, WriteStrategy::Overwrite)
- .with_context(|| format!("Failed to reset the exercise {self}"))?;
- }
-
- Ok(())
- }
-
pub fn terminal_link(&self) -> StyledContent<TerminalFileLink<'_>> {
style(TerminalFileLink { path: self.path })
.underlined()