From f42ec5443b300ebe4f978514b7f2e16793a58801 Mon Sep 17 00:00:00 2001 From: Yukon <126093594+baseGame@users.noreply.github.com> Date: Wed, 7 Oct 2026 04:57:40 +0800 Subject: [PATCH] Clarify CLI help, usage errors, and shell tips MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make first-time CLI and desktop handoff friendlier: quick-start help, plain desktop-file wording, unknown-command and missing-path tips that point to --help, clearer runtime IO messages, Options → Shell CLI hints, and a clearer Linux Open With desktop comment. --- scripts/linux/install-shell-integration.sh | 4 +- src-tauri/crates/cli-core/src/lib.rs | 107 ++++++++++++++++++--- src/app/unixShellScripts.test.ts | 3 + src/i18n/locales/de-DE.ts | 10 +- src/i18n/locales/en-US.ts | 10 +- src/i18n/locales/es-ES.ts | 10 +- src/i18n/locales/fr-FR.ts | 10 +- src/i18n/locales/ja-JP.ts | 11 ++- src/i18n/locales/ko-KR.ts | 10 +- src/i18n/locales/zh-CN.ts | 11 ++- src/i18n/locales/zh-TW.ts | 11 ++- src/views/SettingsView.test.ts | 11 +++ src/views/SettingsView.vue | 8 ++ 13 files changed, 164 insertions(+), 52 deletions(-) diff --git a/scripts/linux/install-shell-integration.sh b/scripts/linux/install-shell-integration.sh index 21ad8913..576a0af9 100755 --- a/scripts/linux/install-shell-integration.sh +++ b/scripts/linux/install-shell-integration.sh @@ -33,7 +33,7 @@ Type=Application Version=1.0 Name=Compare with ${PRODUCT_NAME} GenericName=File Compare -Comment=Open paths with ${PRODUCT_NAME} via shell-compare +Comment=Compare files or folders with ${PRODUCT_NAME} Exec="${exec_path}" --shell-compare %f Icon=utilities-file-compare Terminal=false @@ -54,4 +54,4 @@ if command -v update-desktop-database >/dev/null 2>&1; then fi echo "Installed $desktop" -echo "CLI: open-diff-cli shell-compare [--select-left] " +echo "Try: open-diff-cli --help or open-diff-cli left right or open-diff-cli shell-compare [--select-left] " diff --git a/src-tauri/crates/cli-core/src/lib.rs b/src-tauri/crates/cli-core/src/lib.rs index b7c217a5..8837631a 100644 --- a/src-tauri/crates/cli-core/src/lib.rs +++ b/src-tauri/crates/cli-core/src/lib.rs @@ -254,7 +254,7 @@ where /// Accept `open-diff-app LEFT RIGHT` (and optional open switches) without an `open` verb. fn parse_bare_open_compare(first: &str, rest: Vec) -> Result { if normalized_switch(first).is_some() { - return Err(usage_error(format!("unknown command: {first}"))); + return Err(usage_error(unknown_command_message(first))); } let mut open_args = Vec::with_capacity(rest.len() + 1); @@ -269,20 +269,39 @@ fn parse_bare_open_compare(first: &str, rest: Vec) -> Result String { + format!( + "Unknown command `{command}`. Compare two paths with `open-diff-cli left right`, or run `open-diff-cli --help`." + ) +} + +fn with_help_hint(message: impl Into) -> String { + format!("{} Run `open-diff-cli --help` for usage.", message.into()) +} + pub fn cli_exit_code_value(exit_code: CliExitCode) -> i32 { exit_code as i32 } pub fn cli_help_text() -> String { let mut lines = vec![ + "Open Diff command-line helper".to_owned(), + String::new(), + "Quick start:".to_owned(), + " open-diff-cli left.txt right.txt open two paths in the app".to_owned(), + " open-diff-cli compare a.txt b.txt compare text files in the terminal".to_owned(), + " open-diff-cli compare-folders A B compare folders in the terminal".to_owned(), + String::new(), "Usage: open-diff-cli [args]".to_owned(), + " open-diff-cli same as open (desktop file handoff)".to_owned(), + String::new(), "Commands:".to_owned(), " compare [--quiet] ".to_owned(), " compare-folders [--quiet] ".to_owned(), @@ -294,7 +313,6 @@ pub fn cli_help_text() -> String { " script ".to_owned(), " open-session ".to_owned(), " open [options] ".to_owned(), - " same as open (GUI / desktop %F handoff)".to_owned(), " --session folder-compare, folder-sync, folder-merge,".to_owned(), " text-compare, text-merge, text-edit, text-patch,".to_owned(), " table-compare, hex-compare, picture-compare,".to_owned(), @@ -315,6 +333,11 @@ pub fn cli_help_text() -> String { " sync-preview|sync [--quiet] ".to_owned(), " merge-text --automerge [--favor-left|--favor-right] [output]" .to_owned(), + String::new(), + "Desktop / file manager:".to_owned(), + " Install shell integration from Options → Shell, or pass two paths so the".to_owned(), + " app opens them (Linux .desktop Exec uses %F for selected files).".to_owned(), + String::new(), "Switches accept --name, -name, or /name forms.".to_owned(), "Exit codes:".to_owned(), ]; @@ -753,7 +776,9 @@ fn parse_shell_compare(args: Vec) -> Result) -> Result) -> Result { if args.len() != 1 { - return Err(usage_error("script requires SCRIPT_PATH")); + return Err(usage_error(with_help_hint( + "script needs a script file path", + ))); } Ok(CliInvocation { @@ -898,7 +925,9 @@ fn parse_compare_files(args: Vec) -> Result) -> Result) -> Result if left.is_none() && right.is_none() { if positionals.len() != 2 { - return Err(usage_error( - "open requires LEFT and RIGHT paths (or --left/--right)", - )); + return Err(usage_error(with_help_hint( + "open needs two paths, for example: open-diff-cli open left.txt right.txt", + ))); } left = Some(positionals[0].clone()); right = Some(positionals[1].clone()); } else if left.is_none() || right.is_none() { - return Err(usage_error("open requires both --left and --right")); + return Err(usage_error(with_help_hint( + "open needs both --left and --right paths", + ))); } else if !positionals.is_empty() { return Err(usage_error( "open does not accept extra positional paths with --left/--right", @@ -1090,7 +1121,9 @@ fn parse_sync_preview(args: Vec) -> Result } } if positionals.len() != 2 { - return Err(usage_error("sync-preview requires LEFT and RIGHT paths")); + return Err(usage_error(with_help_hint( + "sync-preview needs two folder paths", + ))); } Ok(CliInvocation { @@ -1236,7 +1269,9 @@ pub fn preview_folder_sync_cli( fn parse_open_session(args: Vec) -> Result { if args.len() != 2 { - return Err(usage_error("open-session requires STORE_ROOT and NAME")); + return Err(usage_error(with_help_hint( + "open-session needs a store root and session name", + ))); } Ok(CliInvocation { @@ -1354,11 +1389,39 @@ fn session_type_label(session_type: &session_core::SessionType) -> &'static str fn runtime_error(error: impl std::fmt::Debug) -> CliRuntimeError { CliRuntimeError { - message: format!("{error:?}"), + message: plain_runtime_error_message(&format!("{error:?}")), exit_code: CliExitCode::IoError, } } +fn plain_runtime_error_message(raw: &str) -> String { + if let Some(inner) = raw + .strip_prefix("NotFound(") + .and_then(|value| value.strip_suffix(')')) + { + let path = inner.trim().trim_matches('"'); + return format!("Path could not be found: {path}"); + } + + if let Some(inner) = raw + .strip_prefix("Io(") + .and_then(|value| value.strip_suffix(')')) + { + let detail = inner.trim().trim_matches('"'); + return format!("Could not read or write a file: {detail}"); + } + + if raw.contains("UnsupportedEncoding") { + return "That file uses an unsupported text encoding.".to_owned(); + } + + if raw.len() > 180 { + return format!("{}...", &raw[..177]); + } + + raw.to_owned() +} + fn merge_options_for_favor(favor: Option) -> merge_core::TextMergeOptions { merge_core::TextMergeOptions { conflict_policy: match favor { @@ -1558,13 +1621,26 @@ mod tests { #[test] fn parses_open_session_flags_and_help_text() { let help = cli_help_text(); + assert!(help.contains("Quick start:")); + assert!(help.contains("open-diff-cli left.txt right.txt")); assert!(help.contains("open [options]")); assert!(help.contains("--center ")); assert!(help.contains("--left-readonly")); + assert!(help.contains("Desktop / file manager:")); + assert!(!help.contains("%F handoff")); assert!(help.contains("Exit codes:")); assert!(help.contains("0 success")); assert!(help.contains("1 differences detected")); + let bare_unknown = parse_cli_args(["open-diff-cli", "not-a-command"]).expect_err("typo"); + assert!(bare_unknown.message.contains("Unknown command")); + assert!(bare_unknown.message.contains("--help")); + + let compare_usage = + parse_cli_args(["open-diff-cli", "compare"]).expect_err("compare needs paths"); + assert!(compare_usage.message.contains("two paths")); + assert!(compare_usage.message.contains("--help")); + let open = parse_cli_args([ "open-diff-cli", "open", @@ -1922,7 +1998,8 @@ mod tests { .expect_err("missing right path should fail"); assert_eq!(error.exit_code, CliExitCode::UsageError); - assert!(error.message.contains("compare requires")); + assert!(error.message.contains("two paths")); + assert!(error.message.contains("--help")); } #[test] diff --git a/src/app/unixShellScripts.test.ts b/src/app/unixShellScripts.test.ts index 81ef9b52..e09439bc 100644 --- a/src/app/unixShellScripts.test.ts +++ b/src/app/unixShellScripts.test.ts @@ -15,6 +15,9 @@ describe('unix shell integration scripts', () => { expect(script).toContain('MimeType=') expect(script).toContain('inode/directory') expect(script).toContain('Actions=SelectLeft') + expect(script).toContain('Compare files or folders') + expect(script).toContain('open-diff-cli --help') + expect(script).not.toContain('via shell-compare') }) it('uninstalls the linux desktop entry', () => { diff --git a/src/i18n/locales/de-DE.ts b/src/i18n/locales/de-DE.ts index 96a775bc..d796313f 100644 --- a/src/i18n/locales/de-DE.ts +++ b/src/i18n/locales/de-DE.ts @@ -918,8 +918,9 @@ export const deDE: LanguagePack = { 'ui.installUnixShellIntegration': 'Shell-Integration installieren', 'ui.removeUnixShellIntegration': 'Shell-Integration entfernen', 'ui.unixShellHint': - 'Installiert einen .desktop Open-With-Eintrag unter Linux oder einen shell-compare-Helfer plus Open-With-App-Stub unter macOS. Nutzt CLI --shell-compare.', - 'ui.unixShellCliHint': 'Auch verfügbar: open-diff-cli shell-compare [--select-left] ', + 'Fügt unter Linux „Öffnen mit“ hinzu oder installiert unter macOS einen Helfer zum Vergleichen aus dem Dateimanager.', + 'ui.unixShellCliHint': + 'Im Terminal: open-diff-cli left right oder open-diff-cli shell-compare [--select-left] oder open-diff-cli --help', 'ui.registerShellExtension': 'Explorer-Kontextmenü installieren', 'ui.installExplorerContextMenu': 'Explorer-Kontextmenü installieren', 'ui.removeExplorerContextMenu': 'Explorer-Kontextmenü entfernen', @@ -927,7 +928,7 @@ export const deDE: LanguagePack = { 'Windows only. Unregister script generated but not applied.', 'ui.windowsOnly': 'Nur Windows', 'ui.shellExtensionHint': - 'Fügt „Compare with Open Diff“ und „Select Left File/Folder for Compare“ im Explorer hinzu.', + 'Fügt „Mit Open Diff vergleichen“ und „Links zum Vergleichen wählen“ im Explorer hinzu.', 'ui.shellExtensionFlowHint': 'Zwei Elemente auswählen und Compare wählen, oder zuerst Select Left und dann Compare auf der anderen Seite.', 'ui.policyRemoteDisabled': @@ -1249,7 +1250,8 @@ export const deDE: LanguagePack = { 'ui.textEditingHint': 'Default wrap applies when opening new text compare and edit sessions.', 'ui.openWithHint': 'Enabled applications appear in Folder Compare Open With actions.', 'ui.applicationName': 'Application name', - 'ui.shellOptionsHint': 'Register shell integration so the OS can open paths in OpenDiff.', + 'ui.shellOptionsHint': + 'Explorer oder Dateimanager sollen Pfade in Open Diff öffnen. Im Terminal: open-diff-cli --help oder open-diff-cli left.txt right.txt.', 'ui.backupRetentionCount': 'Nummerierte Sicherungen behalten', 'ui.commandsVisibility': 'Befehle', 'ui.commandsVisibilityHint': diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 743fc43a..8524ab50 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -901,14 +901,15 @@ export const enUS: LanguagePack = { 'ui.installUnixShellIntegration': 'Install shell integration', 'ui.removeUnixShellIntegration': 'Remove shell integration', 'ui.unixShellHint': - 'Installs a .desktop Open With entry on Linux, or a shell-compare helper + Open With app stub on macOS. Reuses CLI --shell-compare.', - 'ui.unixShellCliHint': 'Also available: open-diff-cli shell-compare [--select-left] ', + 'Adds Open With on Linux, or a helper app on macOS, so you can compare from the file manager.', + 'ui.unixShellCliHint': + 'From a terminal: open-diff-cli left right or open-diff-cli shell-compare [--select-left] or open-diff-cli --help', 'ui.registerShellExtension': 'Install Explorer context menu', 'ui.installExplorerContextMenu': 'Install Explorer context menu', 'ui.removeExplorerContextMenu': 'Remove Explorer context menu', 'ui.windowsOnly': 'Windows only', 'ui.shellExtensionHint': - 'Adds Compare with Open Diff and Select Left File/Folder for Compare to Explorer.', + 'Adds Compare with Open Diff and Select Left for Compare to File Explorer.', 'ui.shellExtensionFlowHint': 'Select two items and choose Compare, or Select Left then Compare on the other side.', 'ui.policyRemoteDisabled': 'Remote profiles are disabled by administrator policy.', @@ -1208,7 +1209,8 @@ export const enUS: LanguagePack = { 'Default wrap and first-difference scrolling apply when opening new text sessions.', 'ui.openWithHint': 'Enabled applications appear in Folder Compare Open With actions.', 'ui.applicationName': 'Application name', - 'ui.shellOptionsHint': 'Register shell integration so the OS can open paths in OpenDiff.', + 'ui.shellOptionsHint': + 'Let File Explorer or your file manager open paths in Open Diff. From a terminal, try open-diff-cli --help or open-diff-cli left.txt right.txt.', 'ui.backupRetentionCount': 'Keep numbered backups', 'ui.commandsVisibility': 'Commands', 'ui.commandsVisibilityHint': diff --git a/src/i18n/locales/es-ES.ts b/src/i18n/locales/es-ES.ts index e340dd2a..dd55b975 100644 --- a/src/i18n/locales/es-ES.ts +++ b/src/i18n/locales/es-ES.ts @@ -913,8 +913,9 @@ export const esES: LanguagePack = { 'ui.installUnixShellIntegration': 'Instalar integración de shell', 'ui.removeUnixShellIntegration': 'Quitar integración de shell', 'ui.unixShellHint': - 'Instala una entrada .desktop Abrir con en Linux, o un ayudante shell-compare y una app Abrir con en macOS. Reutiliza CLI --shell-compare.', - 'ui.unixShellCliHint': 'También disponible: open-diff-cli shell-compare [--select-left] ', + 'Añade Abrir con en Linux, o un ayudante en macOS, para comparar desde el administrador de archivos.', + 'ui.unixShellCliHint': + 'Desde una terminal: open-diff-cli left right o open-diff-cli shell-compare [--select-left] o open-diff-cli --help', 'ui.registerShellExtension': 'Instalar menú contextual del Explorador', 'ui.installExplorerContextMenu': 'Instalar menú contextual del Explorador', 'ui.removeExplorerContextMenu': 'Quitar menú contextual del Explorador', @@ -925,7 +926,7 @@ export const esES: LanguagePack = { 'Windows only. Unregister script generated but not applied.', 'ui.windowsOnly': 'Solo Windows', 'ui.shellExtensionHint': - 'Añade Open Diff al Explorador para archivos y carpetas seleccionados.', + 'Añade Comparar con Open Diff y Seleccionar izquierda para comparar en el Explorador.', 'ui.policyRemoteDisabled': 'Los perfiles remotos están deshabilitados por la directiva de administrador.', 'ui.policyPasswordsDisabled': @@ -1233,7 +1234,8 @@ export const esES: LanguagePack = { 'ui.textEditingHint': 'Default wrap applies when opening new text compare and edit sessions.', 'ui.openWithHint': 'Enabled applications appear in Folder Compare Open With actions.', 'ui.applicationName': 'Application name', - 'ui.shellOptionsHint': 'Register shell integration so the OS can open paths in OpenDiff.', + 'ui.shellOptionsHint': + 'Permite que el Explorador o el administrador de archivos abran rutas en Open Diff. En terminal: open-diff-cli --help o open-diff-cli left.txt right.txt.', 'ui.backupRetentionCount': 'Conservar copias de seguridad numeradas', 'ui.commandsVisibility': 'Comandos', 'ui.commandsVisibilityHint': diff --git a/src/i18n/locales/fr-FR.ts b/src/i18n/locales/fr-FR.ts index 4959bb5f..924e2570 100644 --- a/src/i18n/locales/fr-FR.ts +++ b/src/i18n/locales/fr-FR.ts @@ -913,8 +913,9 @@ export const frFR: LanguagePack = { 'ui.installUnixShellIntegration': 'Installer l’intégration shell', 'ui.removeUnixShellIntegration': 'Supprimer l’intégration shell', 'ui.unixShellHint': - 'Installe une entrée .desktop Ouvrir avec sous Linux, ou un assistant shell-compare et une app Ouvrir avec sous macOS. Réutilise CLI --shell-compare.', - 'ui.unixShellCliHint': 'Aussi disponible : open-diff-cli shell-compare [--select-left] ', + 'Ajoute Ouvrir avec sous Linux, ou un assistant sous macOS, pour comparer depuis le gestionnaire de fichiers.', + 'ui.unixShellCliHint': + 'Depuis un terminal : open-diff-cli left right ou open-diff-cli shell-compare [--select-left] ou open-diff-cli --help', 'ui.registerShellExtension': 'Installer le menu contextuel Explorateur', 'ui.installExplorerContextMenu': 'Installer le menu contextuel Explorateur', 'ui.removeExplorerContextMenu': 'Supprimer le menu contextuel Explorateur', @@ -925,7 +926,7 @@ export const frFR: LanguagePack = { 'Windows only. Unregister script generated but not applied.', 'ui.windowsOnly': 'Windows uniquement', 'ui.shellExtensionHint': - 'Ajoute Open Diff à l’Explorateur pour les fichiers et dossiers sélectionnés.', + 'Ajoute Comparer avec Open Diff et Sélectionner à gauche pour comparer dans l’Explorateur.', 'ui.policyRemoteDisabled': 'Les profils distants sont désactivés par la stratégie d’administration.', 'ui.policyPasswordsDisabled': @@ -1248,7 +1249,8 @@ export const frFR: LanguagePack = { 'ui.textEditingHint': 'Default wrap applies when opening new text compare and edit sessions.', 'ui.openWithHint': 'Enabled applications appear in Folder Compare Open With actions.', 'ui.applicationName': 'Application name', - 'ui.shellOptionsHint': 'Register shell integration so the OS can open paths in OpenDiff.', + 'ui.shellOptionsHint': + 'Permet à l’Explorateur ou au gestionnaire de fichiers d’ouvrir des chemins dans Open Diff. En terminal : open-diff-cli --help ou open-diff-cli left.txt right.txt.', 'ui.backupRetentionCount': 'Conserver les sauvegardes numérotées', 'ui.commandsVisibility': 'Commandes', 'ui.commandsVisibilityHint': diff --git a/src/i18n/locales/ja-JP.ts b/src/i18n/locales/ja-JP.ts index d5f0c782..0e28c32e 100644 --- a/src/i18n/locales/ja-JP.ts +++ b/src/i18n/locales/ja-JP.ts @@ -898,8 +898,9 @@ export const jaJP: LanguagePack = { 'ui.installUnixShellIntegration': 'シェル連携をインストール', 'ui.removeUnixShellIntegration': 'シェル連携を削除', 'ui.unixShellHint': - 'Linux では .desktop の「別のアプリで開く」を、macOS では shell-compare ヘルパーと Open With 用アプリをインストールします。CLI --shell-compare を再利用します。', - 'ui.unixShellCliHint': 'CLI も利用可: open-diff-cli shell-compare [--select-left] ', + 'Linux では「別のアプリで開く」、macOS ではヘルパーを追加し、ファイルマネージャから比較できます。', + 'ui.unixShellCliHint': + 'ターミナル: open-diff-cli left right または open-diff-cli shell-compare [--select-left] または open-diff-cli --help', 'ui.registerShellExtension': 'エクスプローラーのコンテキストメニューをインストール', 'ui.installExplorerContextMenu': 'エクスプローラーのコンテキストメニューをインストール', 'ui.removeExplorerContextMenu': 'エクスプローラーのコンテキストメニューを削除', @@ -908,8 +909,7 @@ export const jaJP: LanguagePack = { 'status.shellUnregisterScriptGenerated': 'Windows only. Unregister script generated but not applied.', 'ui.windowsOnly': 'Windows のみ', - 'ui.shellExtensionHint': - '選択したファイルとフォルダーに対してエクスプローラーへ Open Diff を追加します。', + 'ui.shellExtensionHint': 'エクスプローラーに Open Diff で比較と左側を選んで比較を追加します。', 'ui.policyRemoteDisabled': '管理者ポリシーによりリモートプロファイルは無効です。', 'ui.policyPasswordsDisabled': '管理者ポリシーによりパスワードの保存は無効です。', 'status.shellRegistered': @@ -1207,7 +1207,8 @@ export const jaJP: LanguagePack = { 'ui.textEditingHint': 'Default wrap applies when opening new text compare and edit sessions.', 'ui.openWithHint': 'Enabled applications appear in Folder Compare Open With actions.', 'ui.applicationName': 'Application name', - 'ui.shellOptionsHint': 'Register shell integration so the OS can open paths in OpenDiff.', + 'ui.shellOptionsHint': + 'エクスプローラーやファイルマネージャから Open Diff でパスを開けます。ターミナルでは open-diff-cli --help または open-diff-cli left.txt right.txt を試してください。', 'ui.backupRetentionCount': '番号付きバックアップを保持', 'ui.commandsVisibility': 'コマンド', 'ui.commandsVisibilityHint': diff --git a/src/i18n/locales/ko-KR.ts b/src/i18n/locales/ko-KR.ts index 56786cc9..c82bdb6d 100644 --- a/src/i18n/locales/ko-KR.ts +++ b/src/i18n/locales/ko-KR.ts @@ -889,8 +889,9 @@ export const koKR: LanguagePack = { 'ui.installUnixShellIntegration': '셸 통합 설치', 'ui.removeUnixShellIntegration': '셸 통합 제거', 'ui.unixShellHint': - 'Linux에는 .desktop 다른 앱으로 열기 항목을, macOS에는 shell-compare 도우미와 Open With 앱 스텁을 설치합니다. CLI --shell-compare를 재사용합니다.', - 'ui.unixShellCliHint': 'CLI도 사용 가능: open-diff-cli shell-compare [--select-left] ', + 'Linux에서는 다른 앱으로 열기를, macOS에서는 도우미를 추가해 파일 관리자에서 비교할 수 있습니다.', + 'ui.unixShellCliHint': + '터미널: open-diff-cli left right 또는 open-diff-cli shell-compare [--select-left] 또는 open-diff-cli --help', 'ui.registerShellExtension': '탐색기 컨텍스트 메뉴 설치', 'ui.installExplorerContextMenu': '탐색기 컨텍스트 메뉴 설치', 'ui.removeExplorerContextMenu': '탐색기 컨텍스트 메뉴 제거', @@ -899,7 +900,7 @@ export const koKR: LanguagePack = { 'status.shellUnregisterScriptGenerated': 'Windows only. Unregister script generated but not applied.', 'ui.windowsOnly': 'Windows 전용', - 'ui.shellExtensionHint': '선택한 파일과 폴더에 대해 탐색기에 Open Diff를 추가합니다.', + 'ui.shellExtensionHint': '탐색기에 Open Diff로 비교와 왼쪽 선택 후 비교를 추가합니다.', 'ui.policyRemoteDisabled': '관리자 정책으로 원격 프로필이 비활성화되었습니다.', 'ui.policyPasswordsDisabled': '관리자 정책으로 비밀번호 저장이 비활성화되었습니다.', 'status.shellRegistered': 'Windows 탐색기 컨텍스트 메뉴가 설치되었습니다', @@ -1193,7 +1194,8 @@ export const koKR: LanguagePack = { 'ui.textEditingHint': 'Default wrap applies when opening new text compare and edit sessions.', 'ui.openWithHint': 'Enabled applications appear in Folder Compare Open With actions.', 'ui.applicationName': 'Application name', - 'ui.shellOptionsHint': 'Register shell integration so the OS can open paths in OpenDiff.', + 'ui.shellOptionsHint': + '탐색기나 파일 관리자가 Open Diff에서 경로를 열게 합니다. 터미널에서는 open-diff-cli --help 또는 open-diff-cli left.txt right.txt를 시도하세요.', 'ui.backupRetentionCount': '번호 지정 백업 유지', 'ui.commandsVisibility': '명령', 'ui.commandsVisibilityHint': diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index d3d2909f..c01dcd40 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -864,14 +864,14 @@ export const zhCN: LanguagePack = { 'ui.installUnixShellIntegration': '安装外壳集成', 'ui.removeUnixShellIntegration': '移除外壳集成', 'ui.unixShellHint': - 'Linux 安装 .desktop Open With 条目;macOS 安装 shell-compare 助手与 Open With 应用桩。复用 CLI --shell-compare。', - 'ui.unixShellCliHint': '也可使用:open-diff-cli shell-compare [--select-left] ', + '在 Linux 添加“用其他应用打开”,或在 macOS 安装助手,以便从文件管理器比较。', + 'ui.unixShellCliHint': + '终端可用:open-diff-cli left right 或 open-diff-cli shell-compare [--select-left] 或 open-diff-cli --help', 'ui.registerShellExtension': '安装资源管理器右键菜单', 'ui.installExplorerContextMenu': '安装资源管理器右键菜单', 'ui.removeExplorerContextMenu': '移除资源管理器右键菜单', 'ui.windowsOnly': '仅 Windows', - 'ui.shellExtensionHint': - '在资源管理器中添加“使用 Open Diff 比较”和“选择左侧文件/文件夹以便比较”。', + 'ui.shellExtensionHint': '在资源管理器中添加“用 Open Diff 比较”和“选择左侧以便比较”。', 'ui.shellExtensionFlowHint': '可同时选中两项后比较,或先选择左侧,再对另一侧执行比较。', 'ui.policyRemoteDisabled': '管理员策略已禁用远程配置。', 'ui.policyPasswordsDisabled': '管理员策略已禁止保存密码。', @@ -1139,7 +1139,8 @@ export const zhCN: LanguagePack = { 'ui.textEditingHint': '打开新的文本比较和编辑会话时应用默认换行。', 'ui.openWithHint': '启用的应用程序会出现在文件夹比较的“打开方式”操作中。', 'ui.applicationName': '应用程序名称', - 'ui.shellOptionsHint': '注册 shell 集成,以便操作系统用 OpenDiff 打开路径。', + 'ui.shellOptionsHint': + '让资源管理器或文件管理器在 Open Diff 中打开路径。终端可试 open-diff-cli --help 或 open-diff-cli left.txt right.txt。', 'ui.backupRetentionCount': '保留编号备份数量', 'ui.commandsVisibility': '命令', 'ui.commandsVisibilityHint': diff --git a/src/i18n/locales/zh-TW.ts b/src/i18n/locales/zh-TW.ts index e0736e8b..8fd06161 100644 --- a/src/i18n/locales/zh-TW.ts +++ b/src/i18n/locales/zh-TW.ts @@ -865,14 +865,14 @@ export const zhTW: LanguagePack = { 'ui.installUnixShellIntegration': '安裝殼層整合', 'ui.removeUnixShellIntegration': '移除殼層整合', 'ui.unixShellHint': - '在 Linux 安裝 .desktop「以其他程式開啟」項目;在 macOS 安裝 shell-compare 助手與 Open With 應用程式。複用 CLI --shell-compare。', - 'ui.unixShellCliHint': '也可使用:open-diff-cli shell-compare [--select-left] ', + '在 Linux 新增「以其他程式開啟」,或在 macOS 安裝助手,以便從檔案管理員比較。', + 'ui.unixShellCliHint': + '終端機可用:open-diff-cli left right 或 open-diff-cli shell-compare [--select-left] 或 open-diff-cli --help', 'ui.registerShellExtension': '安裝檔案總管右鍵功能表', 'ui.installExplorerContextMenu': '安裝檔案總管右鍵功能表', 'ui.removeExplorerContextMenu': '移除檔案總管右鍵功能表', 'ui.windowsOnly': '僅限 Windows', - 'ui.shellExtensionHint': - '在檔案總管加入「使用 Open Diff 比較」與「選擇左側檔案/資料夾以便比較」。', + 'ui.shellExtensionHint': '在檔案總管新增「以 Open Diff 比較」與「選擇左側以便比較」。', 'ui.shellExtensionFlowHint': '可同時選取兩項後比較,或先選擇左側,再對另一側執行比較。', 'ui.policyRemoteDisabled': '系統管理員原則已停用遠端設定。', 'ui.policyPasswordsDisabled': '系統管理員原則已禁止儲存密碼。', @@ -1141,7 +1141,8 @@ export const zhTW: LanguagePack = { 'ui.textEditingHint': '開啟新的文字比較與編輯工作階段時套用預設換行。', 'ui.openWithHint': '啟用的應用程式會出現在資料夾比較的「開啟方式」操作中。', 'ui.applicationName': '應用程式名稱', - 'ui.shellOptionsHint': '註冊 shell 整合,讓作業系統可用 OpenDiff 開啟路徑。', + 'ui.shellOptionsHint': + '讓檔案總管或檔案管理員在 Open Diff 開啟路徑。終端機可試 open-diff-cli --help 或 open-diff-cli left.txt right.txt。', 'ui.backupRetentionCount': '保留編號備份數量', 'ui.commandsVisibility': '命令', 'ui.commandsVisibilityHint': diff --git a/src/views/SettingsView.test.ts b/src/views/SettingsView.test.ts index 64d7c7f5..c1338275 100644 --- a/src/views/SettingsView.test.ts +++ b/src/views/SettingsView.test.ts @@ -57,6 +57,17 @@ describe('SettingsView', () => { vi.spyOn(window, 'confirm').mockReturnValue(true) }) + it('surfaces CLI help tips on the Shell options card', async () => { + const wrapper = mount(SettingsView) + + await wrapper.find('[data-testid="options-section-shell"]').trigger('click') + expect(wrapper.find('[data-testid="options-shell-card"]').isVisible()).toBe(true) + expect(wrapper.find('[data-testid="shell-cli-hint"]').text()).toContain('open-diff-cli --help') + expect(wrapper.find('[data-testid="options-shell-card"]').text()).toContain( + 'left.txt right.txt', + ) + }) + it('explains Options vs Session Settings without Policy jargon', () => { const wrapper = mount(SettingsView) diff --git a/src/views/SettingsView.vue b/src/views/SettingsView.vue index 7c89a21f..d89f79e6 100644 --- a/src/views/SettingsView.vue +++ b/src/views/SettingsView.vue @@ -2554,6 +2554,12 @@ function parseShortcutText(value: string): string[] { data-testid="options-shell-card" >

{{ $t('ui.shellOptionsHint') }}

+

+ {{ $t('ui.unixShellCliHint') }} +

{{ $t('ui.windowsShell') }} {{ $t('ui.shellExtensionHint') }} + {{ $t('ui.shellExtensionFlowHint') }}