diff options
| -rw-r--r-- | locales/help_docs/en.yml | 6 | ||||
| -rw-r--r-- | locales/help_docs/zh-CN.yml | 14 | ||||
| -rw-r--r-- | src/bin/jv.rs | 32 |
3 files changed, 37 insertions, 15 deletions
diff --git a/locales/help_docs/en.yml b/locales/help_docs/en.yml index f03d5b8..94ed6b8 100644 --- a/locales/help_docs/en.yml +++ b/locales/help_docs/en.yml @@ -733,11 +733,13 @@ jv: sheet: list: your_sheet: | - **YOURS**: + **VISIBLE TO YOU**: your_sheet_item: | %{number}. %{name} your_sheet_item_use: | - %{number}. %{name} (CURRENT) + %{number}. %{name} [Current] + reference_sheet_suffix: | + [REF] other_sheet: | **OTHERS**: other_sheet_item: | diff --git a/locales/help_docs/zh-CN.yml b/locales/help_docs/zh-CN.yml index ca1f131..d8a8014 100644 --- a/locales/help_docs/zh-CN.yml +++ b/locales/help_docs/zh-CN.yml @@ -130,7 +130,7 @@ jvv: vault_init_failed: 初始化库失败! size_calc_error: 计算库存储大小失败! member_ids_failed: 获得成员 ID 失败! - ref_sheet_not_found: 未找到参照表 `ref`,该参照表理应存在! + ref_sheet_not_found: 未找到参考表 `ref`,该参考表理应存在! create: not_empty: 禁止的操作!指定的目录已经存在 @@ -255,9 +255,9 @@ jv: info <文件> - 显示单个文件的状态 **文件传递**: - share <文件> <表> <描述> - 分享当前上下文的文件至其他表 [[cyan]][远程][[/]] - share import <分享ID> - 将分享导入到当前表 [[cyan]][远程][[/]] - share status - 显示当前表的分享状态 + share <文件> <表> <描述> - 分享映射到其他表 [[cyan]][远程][[/]] + share <分享ID> - 将分享导入到当前表 [[cyan]][远程][[/]] + share <REF表> <文件> - 从其他参考表中导入映射 [[cyan]][远程][[/]] **文件操作**: move <文件> <到> - 安全地重命名文件 [[cyan]][远程][[/]] @@ -723,11 +723,13 @@ jv: sheet: list: your_sheet: | - **您的表**: + **您可见的表**: your_sheet_item: | %{number}. %{name} your_sheet_item_use: | - %{number}. %{name}(当前) + %{number}. %{name} [[green]][当前][[/]] + reference_sheet_suffix: | + [参考] other_sheet: | **其他表**: other_sheet_item: | diff --git a/src/bin/jv.rs b/src/bin/jv.rs index 3453ee1..9ac6bbf 100644 --- a/src/bin/jv.rs +++ b/src/bin/jv.rs @@ -2075,12 +2075,15 @@ async fn jv_sheet_list(args: SheetListArgs) { if args.raw { // Print your sheets if !args.others && !args.all || !args.others { - latest_info.my_sheets.iter().for_each(|s| println!("{}", s)); + latest_info + .visible_sheets + .iter() + .for_each(|s| println!("{}", s)); } // Print other sheets if args.others || args.all { latest_info - .other_sheets + .invisible_sheets .iter() .for_each(|s| println!("{}", s.sheet_name)); } @@ -2089,7 +2092,19 @@ async fn jv_sheet_list(args: SheetListArgs) { if !args.others && !args.all || !args.others { println!("{}", md(t!("jv.success.sheet.list.your_sheet"))); let in_use = local_cfg.sheet_in_use(); - for sheet in latest_info.my_sheets { + for sheet in latest_info.visible_sheets { + let is_ref_sheet = latest_info.reference_sheets.contains(&sheet); + let display_name = if is_ref_sheet { + format!( + "{} {}", + sheet, + md(t!("jv.success.sheet.list.reference_sheet_suffix")) + .truecolor(128, 128, 128) + ) + } else { + sheet.clone() + }; + if let Some(in_use) = in_use && in_use == &sheet { @@ -2098,7 +2113,7 @@ async fn jv_sheet_list(args: SheetListArgs) { md(t!( "jv.success.sheet.list.your_sheet_item_use", number = your_sheet_counts + 1, - name = sheet + name = display_name.cyan() )) ); } else { @@ -2107,7 +2122,7 @@ async fn jv_sheet_list(args: SheetListArgs) { md(t!( "jv.success.sheet.list.your_sheet_item", number = your_sheet_counts + 1, - name = sheet + name = display_name )) ); } @@ -2121,7 +2136,7 @@ async fn jv_sheet_list(args: SheetListArgs) { println!(); } println!("{}", md(t!("jv.success.sheet.list.other_sheet"))); - for sheet in latest_info.other_sheets { + for sheet in latest_info.invisible_sheets { if let Some(holder) = sheet.holder_name { println!( "{}", @@ -2182,6 +2197,9 @@ async fn jv_sheet_use(args: SheetUseArgs) { eprintln!("{}", t!("jv.fail.write_cfg").trim()); return; }; + + // After successfully switching sheets, status should be automatically prompted + jv_status(StatusArgs { help: false }).await; } Err(e) => match e.kind() { std::io::ErrorKind::AlreadyExists => {} // Already In Use @@ -2274,7 +2292,7 @@ async fn jv_sheet_make(args: SheetMakeArgs) { }; if latest_info - .other_sheets + .invisible_sheets .iter() .any(|sheet| sheet.sheet_name == sheet_name && sheet.holder_name.is_none()) { |
