diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-12-08 19:42:12 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-12-08 19:42:12 +0800 |
| commit | 05f91c8a0191b2cb4ef0baa9690abc5d83fd2f1e (patch) | |
| tree | 239f48d547d409d82493ca9a4362a654ec0afb2f /src/bin/jv.rs | |
| parent | 9221e90c81b43b796d8ad8be08b4fa65a55d24de (diff) | |
Add --overwrite flag to track command and show skipped files
The flag allows users to confirm overwriting locally modified files
during sync operations. When files are skipped due to local
modifications, a warning message now displays the skipped files and
provides the command to overwrite them.
Diffstat (limited to 'src/bin/jv.rs')
| -rw-r--r-- | src/bin/jv.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/bin/jv.rs b/src/bin/jv.rs index 49f39bc..de92a69 100644 --- a/src/bin/jv.rs +++ b/src/bin/jv.rs @@ -525,6 +525,10 @@ struct TrackFileArgs { /// Track file pattern track_file_pattern: Option<String>, + /// Overwrite modified + #[arg(short = 'o', long = "overwrite")] + allow_overwrite: bool, + /// Commit - Description #[arg(short, long)] desc: Option<String>, @@ -2366,6 +2370,7 @@ async fn jv_track(args: TrackFileArgs) { }; let files = track_files.iter().cloned().collect(); + let overwrite = args.allow_overwrite; let update_info = get_update_info(local_workspace, &files, args).await; match proc_track_file_action( @@ -2375,6 +2380,7 @@ async fn jv_track(args: TrackFileArgs) { relative_pathes: files, file_update_info: update_info, print_infos: true, + allow_overwrite_modified: overwrite, }, ) .await @@ -2384,6 +2390,7 @@ async fn jv_track(args: TrackFileArgs) { created, updated, synced, + skipped, } => { println!( "{}", @@ -2395,6 +2402,23 @@ async fn jv_track(args: TrackFileArgs) { synced = synced.len() )) ); + + if skipped.len() > 0 { + println!( + "\n{}", + md(t!( + "jv.result.track.tip_has_skipped", + skipped_num = skipped.len(), + skipped = skipped + .iter() + .map(|f| f.display().to_string()) + .collect::<Vec<String>>() + .join("\n") + .trim() + )) + .yellow() + ); + } } TrackFileActionResult::AuthorizeFailed(e) => { eprintln!("{}", md(t!("jv.result.common.authroize_failed", err = e))) |
