Merge branch 'main' into dev

This commit is contained in:
Tw93
2025-08-05 15:22:20 +08:00
4 changed files with 43 additions and 19 deletions

11
bin/cli.ts vendored
View File

@@ -22,7 +22,16 @@ program.addHelpText('beforeAll', logo).usage(`[url] [options]`).showHelpAfterErr
program
.argument('[url]', 'The web URL you want to package', validateUrlInput)
.option('--name <string>', 'Application name')
// Refer to https://github.com/tj/commander.js#custom-option-processing, turn string array into a string connected with custom connectors.
// If the platform is Linux, use `-` as the connector, and convert all characters to lowercase.
// For example, Google Translate will become google-translate.
.option('--name <string...>', 'Application name', (value, previous) => {
const platform = process.platform
const connector = platform === 'linux' ? '-' : ' '
const name = previous === undefined ? value : `${previous}${connector}${value}`
return platform === 'linux' ? name.toLowerCase() : name
})
.option('--icon <string>', 'Application icon', DEFAULT.icon)
.option('--width <number>', 'Window width', validateNumberInput, DEFAULT.width)
.option('--height <number>', 'Window height', validateNumberInput, DEFAULT.height)