summaryrefslogtreecommitdiff
path: root/src/cmds/converter/make_sheet_error.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-03-18 22:50:03 +0800
committer魏曹先生 <1992414357@qq.com>2026-03-18 22:50:03 +0800
commit74bc8902be593796eb6292151e08374072766e3e (patch)
treef3de024bf06753649ff2a51587ee5e54a1c92435 /src/cmds/converter/make_sheet_error.rs
parent5372793a49567dcba7315bf8e7bc5a1cab2d5a76 (diff)
Add workspace sheet command with help and localization
Diffstat (limited to 'src/cmds/converter/make_sheet_error.rs')
-rw-r--r--src/cmds/converter/make_sheet_error.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/cmds/converter/make_sheet_error.rs b/src/cmds/converter/make_sheet_error.rs
new file mode 100644
index 0000000..8bbc45d
--- /dev/null
+++ b/src/cmds/converter/make_sheet_error.rs
@@ -0,0 +1,22 @@
+use crate::systems::cmd::errors::CmdExecuteError;
+use just_enough_vcs::system::workspace::workspace::manager::sheet_state::error::MakeSheetError;
+use rust_i18n::t;
+
+pub struct MakeSheetErrorConverter;
+
+impl MakeSheetErrorConverter {
+ pub fn to_exec_error(err: MakeSheetError) -> CmdExecuteError {
+ match err {
+ MakeSheetError::SheetAlreadyExists => {
+ CmdExecuteError::Error(t!("make_sheet_error.sheet_already_exists").to_string())
+ }
+ MakeSheetError::SheetNotFound => {
+ CmdExecuteError::Error(t!("make_sheet_error.sheet_not_found").to_string())
+ }
+ MakeSheetError::Io(error) => CmdExecuteError::Io(error),
+ MakeSheetError::Other(error) => CmdExecuteError::Error(
+ t!("make_sheet_error.other", error = error.to_string()).to_string(),
+ ),
+ }
+ }
+}