Dry run fixup

This commit is contained in:
Roey Darwish Dror
2018-12-31 14:05:15 +02:00
parent 2cac8a7970
commit 19de361775
6 changed files with 43 additions and 61 deletions

View File

@@ -5,7 +5,6 @@ use failure::ResultExt;
use std::ffi::{OsStr, OsString};
use std::path::Path;
use std::process::{Child, Command, ExitStatus};
use std::str::{FromStr, ParseBoolError};
/// An enum telling whether Topgrade should perform dry runs or actually perform the steps.
#[derive(Clone, Copy, Debug)]
@@ -19,7 +18,7 @@ pub enum RunType {
impl RunType {
/// Create a new instance from a boolean telling whether to dry run.
fn new(dry_run: bool) -> Self {
pub fn new(dry_run: bool) -> Self {
if dry_run {
RunType::Dry
} else {
@@ -48,14 +47,6 @@ impl RunType {
}
}
impl FromStr for RunType {
type Err = ParseBoolError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(Self::new(bool::from_str(s)?))
}
}
/// An enum providing a similar interface to `std::process::Command`.
/// If the enum is set to `Wet`, execution will be performed with `std::process::Command`.
/// If the enum is set to `Dry`, execution will just print the command with its arguments.