✨ hide-on-close support param
This commit is contained in:
3
bin/builders/BaseBuilder.ts
vendored
3
bin/builders/BaseBuilder.ts
vendored
@@ -7,6 +7,7 @@ import { PakeAppOptions } from '@/types';
|
|||||||
import { checkRustInstalled, installRust } from '@/helpers/rust';
|
import { checkRustInstalled, installRust } from '@/helpers/rust';
|
||||||
import { mergeConfig } from '@/helpers/merge';
|
import { mergeConfig } from '@/helpers/merge';
|
||||||
import tauriConfig from '@/helpers/tauriConfig';
|
import tauriConfig from '@/helpers/tauriConfig';
|
||||||
|
import { generateIdentifierSafeName } from '@/utils/name';
|
||||||
import { npmDirectory } from '@/utils/dir';
|
import { npmDirectory } from '@/utils/dir';
|
||||||
import { getSpinner } from '@/utils/info';
|
import { getSpinner } from '@/utils/info';
|
||||||
import { shellExec } from '@/utils/shell';
|
import { shellExec } from '@/utils/shell';
|
||||||
@@ -409,7 +410,7 @@ export default abstract class BaseBuilder {
|
|||||||
|
|
||||||
// Linux uses the unique binary name we set in merge.ts
|
// Linux uses the unique binary name we set in merge.ts
|
||||||
if (process.platform === 'linux') {
|
if (process.platform === 'linux') {
|
||||||
return `pake-${appName.toLowerCase()}${extension}`;
|
return `pake-${generateIdentifierSafeName(appName)}${extension}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Windows and macOS use 'pake' as binary name
|
// Windows and macOS use 'pake' as binary name
|
||||||
|
|||||||
8
bin/cli.ts
vendored
8
bin/cli.ts
vendored
@@ -127,10 +127,16 @@ program
|
|||||||
)
|
)
|
||||||
.addOption(
|
.addOption(
|
||||||
new Option(
|
new Option(
|
||||||
'--hide-on-close',
|
'--hide-on-close [boolean]',
|
||||||
'Hide window on close instead of exiting (default: true for macOS, false for others)',
|
'Hide window on close instead of exiting (default: true for macOS, false for others)',
|
||||||
)
|
)
|
||||||
.default(DEFAULT.hideOnClose)
|
.default(DEFAULT.hideOnClose)
|
||||||
|
.argParser((value) => {
|
||||||
|
if (value === undefined) return true; // --hide-on-close without value
|
||||||
|
if (value === 'true') return true;
|
||||||
|
if (value === 'false') return false;
|
||||||
|
throw new Error('--hide-on-close must be true or false');
|
||||||
|
})
|
||||||
.hideHelp(),
|
.hideHelp(),
|
||||||
)
|
)
|
||||||
.addOption(new Option('--title <string>', 'Window title').hideHelp())
|
.addOption(new Option('--title <string>', 'Window title').hideHelp())
|
||||||
|
|||||||
@@ -285,7 +285,12 @@ Specify the system tray icon. This is only effective when the system tray is ena
|
|||||||
Hide window instead of closing the application when clicking close button. Platform-specific default: `true` for macOS, `false` for Windows/Linux.
|
Hide window instead of closing the application when clicking close button. Platform-specific default: `true` for macOS, `false` for Windows/Linux.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
# Hide on close (default behavior on macOS)
|
||||||
--hide-on-close
|
--hide-on-close
|
||||||
|
--hide-on-close true
|
||||||
|
|
||||||
|
# Close application immediately (default behavior on Windows/Linux)
|
||||||
|
--hide-on-close false
|
||||||
```
|
```
|
||||||
|
|
||||||
#### [title]
|
#### [title]
|
||||||
|
|||||||
@@ -284,7 +284,12 @@ pake https://github.com --name GitHub
|
|||||||
点击关闭按钮时隐藏窗口而不是退出应用程序。平台特定默认值:macOS 为 `true`,Windows/Linux 为 `false`。
|
点击关闭按钮时隐藏窗口而不是退出应用程序。平台特定默认值:macOS 为 `true`,Windows/Linux 为 `false`。
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
# 关闭时隐藏(macOS 默认行为)
|
||||||
--hide-on-close
|
--hide-on-close
|
||||||
|
--hide-on-close true
|
||||||
|
|
||||||
|
# 立即关闭应用程序(Windows/Linux 默认行为)
|
||||||
|
--hide-on-close false
|
||||||
```
|
```
|
||||||
|
|
||||||
#### [title]
|
#### [title]
|
||||||
|
|||||||
Reference in New Issue
Block a user