Add experimental support for --yes (fix #172) (#229)

This commit is contained in:
Roey Darwish Dror
2019-09-28 15:45:05 +03:00
committed by GitHub
parent ab318905a1
commit fb38b792a4
3 changed files with 52 additions and 35 deletions

View File

@@ -60,6 +60,7 @@ pub struct ConfigFile {
ssh_arguments: Option<String>,
git_arguments: Option<String>,
set_title: Option<bool>,
assume_yes: Option<bool>,
}
impl ConfigFile {
@@ -154,6 +155,10 @@ pub struct CommandLineArgs {
/// Prompt for a key before exiting
#[structopt(short = "k", long = "keep")]
keep_at_end: bool,
/// Say yes to package manager's prompt (experimental)
#[structopt(short = "y", long = "yes")]
yes: bool,
}
/// Represents the application configuration
@@ -275,4 +280,10 @@ impl Config {
pub fn set_title(&self) -> bool {
self.config_file.set_title.unwrap_or(true)
}
/// Whether to say yes to package managers
#[allow(dead_code)]
pub fn yes(&self) -> bool {
self.config_file.assume_yes.unwrap_or(self.opt.yes)
}
}