Skip to content

Commit

Permalink
make checking for updates a configurable behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
jhspetersson committed Sep 29, 2023
1 parent 2bd38d5 commit 400440b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 400440b

Please sign in to comment.