Add no-self-update config and flag (#388)
This commit is contained in:
@@ -336,6 +336,7 @@ pub struct ConfigFile {
|
||||
vagrant: Option<Vagrant>,
|
||||
flatpak: Option<Flatpak>,
|
||||
distrobox: Option<Distrobox>,
|
||||
no_self_update: Option<bool>,
|
||||
}
|
||||
|
||||
fn config_directory(base_dirs: &BaseDirs) -> PathBuf {
|
||||
@@ -522,6 +523,10 @@ pub struct CommandLineArgs {
|
||||
/// Print roff manpage and exit
|
||||
#[clap(long, hide = true)]
|
||||
pub gen_manpage: bool,
|
||||
|
||||
/// Don't update Topgrade
|
||||
#[clap(long = "no-self-update")]
|
||||
pub no_self_update: bool,
|
||||
}
|
||||
|
||||
impl CommandLineArgs {
|
||||
@@ -645,6 +650,11 @@ impl Config {
|
||||
enabled_steps
|
||||
}
|
||||
|
||||
/// Tell whether we should run a self update.
|
||||
pub fn no_self_update(&self) -> bool {
|
||||
self.opt.no_self_update || self.config_file.no_self_update.unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Tell whether we should run in tmux.
|
||||
pub fn run_in_tmux(&self) -> bool {
|
||||
self.opt.run_in_tmux || self.config_file.run_in_tmux.unwrap_or(false)
|
||||
|
||||
Reference in New Issue
Block a user