From 5ebd07e52b4ebc1f59b603bbd4fe781871056755 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sun, 23 Nov 2025 15:56:13 +0800 Subject: Add auto update feature via JV_AUTO_UPDATE env var When enabled, automatically runs `jv update` if vault content has been modified by local operations. --- src/bin/jv.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/bin') diff --git a/src/bin/jv.rs b/src/bin/jv.rs index e71b6d6..773af96 100644 --- a/src/bin/jv.rs +++ b/src/bin/jv.rs @@ -33,6 +33,7 @@ use just_enough_vcs::{ LocalWorkspace, align::AlignTasks, cached_sheet::CachedSheet, config::LocalConfig, file_status::AnalyzeResult, latest_file_data::LatestFileData, latest_info::LatestInfo, local_files::get_relative_paths, + vault_modified::check_vault_modified, }, member::{Member, MemberId}, user::UserDirectory, @@ -62,7 +63,7 @@ use just_enough_vcs_cli::{ }, utils::{ display::{SimpleTable, md, size_str}, - env::current_locales, + env::{current_locales, enable_auto_update}, fs::move_across_partitions, input::{confirm_hint, confirm_hint_or, input_with_editor, show_in_pager}, socket_addr_helper, @@ -604,6 +605,11 @@ async fn main() { #[cfg(windows)] colored::control::set_virtual_terminal(true).unwrap(); + // Auto update + if enable_auto_update() && check_vault_modified().await { + jv_update(UpdateArgs { help: false }).await; + } + let Ok(parser) = JustEnoughVcsWorkspace::try_parse() else { eprintln!("{}", md(t!("jv.fail.parse.parser_failed"))); -- cgit