summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWeicao-CatilGrass <1992414357@qq.com>2025-12-16 22:06:45 +0800
committerWeicao-CatilGrass <1992414357@qq.com>2025-12-16 22:06:45 +0800
commitb4ae0f05a874fb9f852431d7b5392e41000ccdb6 (patch)
tree81db6dee40aa981829144c5760f3fb5e3438b503
parente7201c79b6a39394fb936d91d2e75f11658d075d (diff)
Improve alignment command suggestions and error messages
-rw-r--r--locales/help_docs/en.yml30
-rw-r--r--locales/help_docs/zh-CN.yml32
-rw-r--r--src/bin/jv.rs33
3 files changed, 83 insertions, 12 deletions
diff --git a/locales/help_docs/en.yml b/locales/help_docs/en.yml
index 7a6d41a..8efc970 100644
--- a/locales/help_docs/en.yml
+++ b/locales/help_docs/en.yml
@@ -530,16 +530,15 @@ jv:
sheet:
align:
no_direction: |
- Cannot confirm alignment direction!
- **Tip**: Use local or remote to indicate whether you want to keep local or remote paths
+ Unable to confirm alignment method!
align_item_not_found: |
Cannot find this alignment item!
**Tip**: Use `jv align` to view available alignment items
- unknown_method: |
- Unknown alignment method!
- **Tip**: Use local or remote to indicate whether you want to keep local or remote paths
+ unknown_moved_direction: |
+ Unknown alignment direction!
+ Please use `local` or `remote` to indicate whether the path is based on local location or remote location
target_exists: |
Cannot align local file `%{local}` to remote address `%{remote}`
@@ -722,6 +721,27 @@ jv:
no_changes: |
Great, no structural deviations in the local workspace, no alignment needed!
+ suggestion_1: |
+ Suggestion **Confirm Erased Items**:
+ The file no longer exists remotely, but it still exists locally!
+ **Example**: Use `jv align %{example_erased} confirm` to confirm this erased item!
+ **Tip**: After confirmation, the local mapping will be erased, and the file at that location will be moved away.
+
+ suggestion_2: |
+ Suggestion **Confirm Lost Items**:
+ Cannot determine if the intent for the lost file is `deletion` or `move`!
+ Therefore, you need to use a command to confirm the action:
+ **Example**: Use `jv align %{example_lost} <action>` to confirm this loss.
+ **Confirm Deletion**: Enter `confirm` to confirm your action is a `deletion`.
+ **Declare Move**: Enter the created item to form a move relationship with it.
+
+ suggestion_3: |
+ Only **Moved Items**, please confirm them based on local or remote.
+ **Example**: Use `jv align moved [local|remote]` to batch align,
+ or Use `jv align %{example_moved} [local|remote]` to precisely align a move.
+ **Align to Local**: Requires network, will modify the upstream mapping to your actual local location.
+ **Align to Remote**: Can be offline, will move the local file to the location of the upstream address.
+
docs:
list:
header: |
diff --git a/locales/help_docs/zh-CN.yml b/locales/help_docs/zh-CN.yml
index 54fcb1e..757acd6 100644
--- a/locales/help_docs/zh-CN.yml
+++ b/locales/help_docs/zh-CN.yml
@@ -518,16 +518,15 @@ jv:
sheet:
align:
no_direction: |
- 无法确认对齐的方向!
- **提示**:使用 local 或 remote 来表示您要保留本地或远程的路径
+ 无法确认对齐的方式!
+ **提示**:您本地有 %{moved} 个移动项,%{lost} 个丢失项,%{erased} 个擦除项目
align_item_not_found: |
无法找到该对齐项!
- **提示**:使用 `jv align` 查看可用对齐项
- unknown_method: |
- 未知的对齐方法!
- **提示**:使用 local 或 remote 来表示您要保留本地或远程的路径
+ unknown_moved_direction: |
+ 未知的对齐方向!
+ 请使用 `local` 或 `remote` 来表示路径基于本地位置或远程位置
target_exists: |
无法对齐本地文件 `%{local}` 至远程地址 `%{remote}`
@@ -714,6 +713,27 @@ jv:
no_changes: |
很好,本地工作区未产生结构偏差,无需对齐!
+ suggestion_1: |
+ 建议 **确认擦除项**:
+ 文件在远程已不存在,但是本地仍存在!
+ **例如**:使用 `jv align %{example_erased} confirm` 来确认该擦除项!
+ **注意**:确认后,本地映射将被擦除,同时,该位置的文件将被移走
+
+ suggestion_2: |
+ 建议 **确认丢失项**:
+ 无法确认文件丢失意图为 `删除` 或 `移动`!
+ 因此,您需要通过命令以确认行为:
+ **例如**:使用 `jv align %{example_lost} <行为>` 来确认该丢失
+ **确认删除**:填写 `confirm` 来确认您的操作是一次 `删除`
+ **声明移动**:填写 创建项 与其形成移动关系
+
+ suggestion_3: |
+ 只有 **移动项**,请确认他们基于本地或远程
+ **例如**:使用 `jv align moved [local|remote]` 批量对齐
+ 或使用 `jv align %{example_moved} [local|remote]` 精确对齐移动
+ **对齐至本地**:需联网,会修改上游映射至您本地实际的位置
+ **对齐至远程**:可脱机,会将本地文件移动至上游地址的位置
+
docs:
list:
header: |
diff --git a/src/bin/jv.rs b/src/bin/jv.rs
index a9f8033..ff0ea8e 100644
--- a/src/bin/jv.rs
+++ b/src/bin/jv.rs
@@ -2438,6 +2438,37 @@ async fn jv_sheet_align(args: SheetAlignArgs) {
"{}",
md(t!("jv.success.sheet.align.list", tasks = table.to_string()))
);
+
+ // Suggestion1: Confirm Erased
+ if align_tasks.erased.len() > 0 {
+ println!(
+ "\n{}",
+ md(t!(
+ "jv.success.sheet.align.suggestion_1",
+ example_erased = align_tasks.erased[0].0
+ ))
+ )
+ } else
+ // Suggestion2: Confirm Lost
+ if align_tasks.lost.len() > 0 {
+ println!(
+ "\n{}",
+ md(t!(
+ "jv.success.sheet.align.suggestion_2",
+ example_lost = align_tasks.lost[0].0
+ ))
+ )
+ } else
+ // Suggestion3: Confirm Moved
+ if align_tasks.moved.len() > 0 {
+ println!(
+ "\n{}",
+ md(t!(
+ "jv.success.sheet.align.suggestion_3",
+ example_moved = align_tasks.moved[0].0
+ ))
+ )
+ }
} else {
println!("{}", md(t!("jv.success.sheet.align.no_changes").trim()));
}
@@ -2456,7 +2487,7 @@ async fn jv_sheet_align(args: SheetAlignArgs) {
"remote" => true,
"local" => false,
_ => {
- eprintln!("{}", md(t!("jv.fail.sheet.align.unknown_method")));
+ eprintln!("{}", md(t!("jv.fail.sheet.align.unknown_moved_direction")));
return;
}
};