From 2af3805b93dfb3c0775472e76a6ba6b98707b952 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Tue, 5 Aug 2025 15:37:30 +0800 Subject: [PATCH] :sparkles: Support two-word naming --- CLAUDE.md | 3 +++ bin/README.md | 9 +++++++++ bin/README_CN.md | 11 ++++++++++- dist/cli.js | 7 +++---- src-tauri/pake.json | 2 +- 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 7cb6f8e..4899cf6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -49,6 +49,9 @@ npm install -g pake-cli # Package a webpage pake https://example.com --name MyApp --width 1200 --height 800 +# Also supports names with spaces (cross-platform compatible) +# pake https://translate.google.com --name "Google Translate" --hide-title-bar + # Development with custom options # Modify DEFAULT_DEV_PAKE_OPTIONS in bin/defaults.ts npm run cli:dev diff --git a/bin/README.md b/bin/README.md index 0a708a0..f97b018 100644 --- a/bin/README.md +++ b/bin/README.md @@ -62,8 +62,17 @@ Various options are available for customization. You can pass corresponding argu Specify the application name. If not provided, you will be prompted to enter it. It is recommended to use English. +**Note**: Also supports multiple words with automatic platform-specific handling: + +- **Windows/macOS**: Preserves spaces and case (e.g., `"Google Translate"`) +- **Linux**: Converts to lowercase with hyphens (e.g., `"google-translate"`) + ```shell --name +--name MyApp + +# Multiple words (if needed): +--name "Google Translate" ``` #### [icon] diff --git a/bin/README_CN.md b/bin/README_CN.md index 02a899d..517e87a 100644 --- a/bin/README_CN.md +++ b/bin/README_CN.md @@ -60,10 +60,19 @@ pake [url] [options] #### [name] -指定应用程序的名称,如果在输入时未指定,系统会提示您输入,建议使用单个英文名称,不要出现下划线或者中文。 +指定应用程序的名称,如果未指定,系统会提示您输入,建议使用英文单词。 + +**注意**: 也支持多个单词,会自动处理不同平台的命名规范: + +- **Windows/macOS**: 保持空格和大小写(如 `"Google Translate"`) +- **Linux**: 转换为小写并用连字符连接(如 `"google-translate"`) ```shell --name +--name MyApp + +# 多个单词(如需要): +--name "Google Translate" ``` #### [icon] diff --git a/dist/cli.js b/dist/cli.js index 33de9ce..91f8e17 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -134,7 +134,8 @@ var windows = [ always_on_top: false, dark_mode: false, activation_shortcut: "", - disabled_web_shortcuts: false + disabled_web_shortcuts: false, + hide_on_close: false } ]; var user_agent = { @@ -147,7 +148,6 @@ var system_tray = { linux: true, windows: true }; -var hide_on_close = true; var system_tray_path = "icons/icon.png"; var inject = [ ]; @@ -156,7 +156,6 @@ var pakeConf = { windows: windows, user_agent: user_agent, system_tray: system_tray, - hide_on_close: hide_on_close, system_tray_path: system_tray_path, inject: inject, proxy_url: proxy_url @@ -445,6 +444,7 @@ async function mergeConfig(url, options, tauriConf) { always_on_top: alwaysOnTop, dark_mode: darkMode, disabled_web_shortcuts: disabledWebShortcuts, + hide_on_close: hideOnClose, }; Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions }); tauriConf.productName = name; @@ -490,7 +490,6 @@ async function mergeConfig(url, options, tauriConf) { tauriConf.pake.user_agent[currentPlatform] = userAgent; } tauriConf.pake.system_tray[currentPlatform] = showSystemTray; - tauriConf.pake.hide_on_close = hideOnClose; // Processing targets are currently only open to Linux. if (platform === 'linux') { delete tauriConf.bundle.linux.deb.files; diff --git a/src-tauri/pake.json b/src-tauri/pake.json index 7460a1a..0f65315 100644 --- a/src-tauri/pake.json +++ b/src-tauri/pake.json @@ -12,7 +12,7 @@ "dark_mode": false, "activation_shortcut": "", "disabled_web_shortcuts": false, - "hide_on_close": false + "hide_on_close": true } ], "user_agent": {