Skip to content

Commit 2fc916d

Browse files
committed
feat: Use user config value to disable version check
1 parent 4ed3463 commit 2fc916d

File tree

1 file changed

+7
-9
lines changed
  • rust/stackablectl/src/cli

1 file changed

+7
-9
lines changed

rust/stackablectl/src/cli/mod.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,7 @@ impl Cli {
212212
// TODO (@Techassi): Move this file name to a constant
213213
let user_config_path = xdg_directories.config_dir().join("config.toml");
214214

215-
let _user_config = UserConfig::from_file_or_default(user_config_path).unwrap();
216-
dbg!(_user_config);
215+
let user_config = UserConfig::from_file_or_default(user_config_path).unwrap();
217216

218217
let cache_settings = self
219218
.cache_settings(xdg_directories.cache_dir())
@@ -240,13 +239,12 @@ impl Cli {
240239
.await;
241240

242241
// Only run the version check in the background if the user runs ANY other command than
243-
// the version command. Also only report if the current version is outdated.
244-
let check_version_in_background = !matches!(self.subcommand, Command::Version(_));
245-
let release_check_future = release_check::version_notice_output(
246-
transfer_client.clone(),
247-
check_version_in_background,
248-
true,
249-
);
242+
// the version command and the check isn't disabled via the user config. Also only report
243+
// if the current version is outdated.
244+
let check_version =
245+
!matches!(self.subcommand, Command::Version(_)) && user_config.version.check_enabled;
246+
let release_check_future =
247+
release_check::version_notice_output(transfer_client.clone(), check_version, true);
250248
let release_check_future =
251249
tokio::time::timeout(std::time::Duration::from_secs(2), release_check_future);
252250

0 commit comments

Comments
 (0)