summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhspetersson <jhspetersson@gmail.com>2023-09-29 15:59:31 +0200
committerjhspetersson <jhspetersson@gmail.com>2023-09-29 15:59:31 +0200
commit400440b2ba1dde9a01f3bc04370f535b18fd79d7 (patch)
tree7b23ac3bda8063809b50500bba97efe0a47abea8
parent2bd38d5c5327d038e664a539cdf8108ddb029893 (diff)
make checking for updates a configurable behavior
-rw-r--r--src/config.rs2
-rw-r--r--src/main.rs2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/config.rs b/src/config.rs
index bcb24bd..dcaf64e 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -23,6 +23,7 @@ pub struct Config {
pub is_source : Vec<String>,
pub is_video : Vec<String>,
pub default_file_size_format : Option<String>,
+ pub check_for_updates: Option<bool>,
#[serde(skip_serializing, default = "get_false")]
pub debug : bool,
#[serde(skip)]
@@ -142,6 +143,7 @@ impl Config {
is_source : vec![String::from(".asm"), String::from(".bas"), String::from(".c"), String::from(".cc"), String::from(".ceylon"), String::from(".clj"), String::from(".coffee"), String::from(".cpp"), String::from(".cs"), String::from(".d"), String::from(".dart"), String::from(".elm"), String::from(".erl"), String::from(".go"), String::from(".groovy"), String::from(".h"), String::from(".hh"), String::from(".hpp"), String::from(".java"), String::from(".jl"), String::from(".js"), String::from(".jsp"), String::from(".jsx"), String::from(".kt"), String::from(".kts"), String::from(".lua"), String::from(".nim"), String::from(".pas"), String::from(".php"), String::from(".pl"), String::from(".pm"), String::from(".py"), String::from(".rb"), String::from(".rs"), String::from(".scala"), String::from(".sol"), String::from(".swift"), String::from(".tcl"), String::from(".ts"), String::from(".vala"), String::from(".vb"), String::from(".zig")],
is_video : vec![String::from(".3gp"), String::from(".avi"), String::from(".flv"), String::from(".m4p"), String::from(".m4v"), String::from(".mkv"), String::from(".mov"), String::from(".mp4"), String::from(".mpeg"), String::from(".mpg"), String::from(".webm"), String::from(".wmv")],
default_file_size_format : Some(String::new()),
+ check_for_updates : Some(false),
debug : false,
save : true,
}
diff --git a/src/main.rs b/src/main.rs
index 51a0f32..6e58a3a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -166,7 +166,7 @@ fn main() -> ExitCode {
config.save();
#[cfg(feature = "update-notifications")]
- if stdout().is_terminal() {
+ if config.check_for_updates.unwrap_or(false) && stdout().is_terminal() {
let name = env!("CARGO_PKG_NAME");
let version = env!("CARGO_PKG_VERSION");
let informer = update_informer::new(registry::Crates, name, version).interval(Duration::from_secs(60 * 60));