Skip to content

Commit f626ad5

Browse files
committed
✨ hide-on-close support param
1 parent 6aaa9a4 commit f626ad5

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

bin/builders/BaseBuilder.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { PakeAppOptions } from '@/types';
77
import { checkRustInstalled, installRust } from '@/helpers/rust';
88
import { mergeConfig } from '@/helpers/merge';
99
import tauriConfig from '@/helpers/tauriConfig';
10+
import { generateIdentifierSafeName } from '@/utils/name';
1011
import { npmDirectory } from '@/utils/dir';
1112
import { getSpinner } from '@/utils/info';
1213
import { shellExec } from '@/utils/shell';
@@ -409,7 +410,7 @@ export default abstract class BaseBuilder {
409410

410411
// Linux uses the unique binary name we set in merge.ts
411412
if (process.platform === 'linux') {
412-
return `pake-${appName.toLowerCase()}${extension}`;
413+
return `pake-${generateIdentifierSafeName(appName)}${extension}`;
413414
}
414415

415416
// Windows and macOS use 'pake' as binary name

bin/cli.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,16 @@ program
127127
)
128128
.addOption(
129129
new Option(
130-
'--hide-on-close',
130+
'--hide-on-close [boolean]',
131131
'Hide window on close instead of exiting (default: true for macOS, false for others)',
132132
)
133133
.default(DEFAULT.hideOnClose)
134+
.argParser((value) => {
135+
if (value === undefined) return true; // --hide-on-close without value
136+
if (value === 'true') return true;
137+
if (value === 'false') return false;
138+
throw new Error('--hide-on-close must be true or false');
139+
})
134140
.hideHelp(),
135141
)
136142
.addOption(new Option('--title <string>', 'Window title').hideHelp())

docs/cli-usage.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,12 @@ Specify the system tray icon. This is only effective when the system tray is ena
285285
Hide window instead of closing the application when clicking close button. Platform-specific default: `true` for macOS, `false` for Windows/Linux.
286286

287287
```shell
288+
# Hide on close (default behavior on macOS)
288289
--hide-on-close
290+
--hide-on-close true
291+
292+
# Close application immediately (default behavior on Windows/Linux)
293+
--hide-on-close false
289294
```
290295

291296
#### [title]

docs/cli-usage_CN.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,12 @@ pake https://github.com --name GitHub
284284
点击关闭按钮时隐藏窗口而不是退出应用程序。平台特定默认值:macOS 为 `true`,Windows/Linux 为 `false`
285285

286286
```shell
287+
# 关闭时隐藏(macOS 默认行为)
287288
--hide-on-close
289+
--hide-on-close true
290+
291+
# 立即关闭应用程序(Windows/Linux 默认行为)
292+
--hide-on-close false
288293
```
289294

290295
#### [title]

0 commit comments

Comments
 (0)