Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.
Rust chatgptclaudeclidesktopdesktop-appelectron-alternativegeminilinuxmacosnativefierno-electronrusttauriweb-to-desktopwebsite-to-appwebviewwindowsyoutube
fix: show all CLI options in help
Tw934c7581ca6fa9
diff --git a/bin/dev.ts b/bin/dev.tsindex 4e4f1b11..02ec81b3 100644--- a/bin/dev.ts+++ b/bin/dev.ts@@ -7,6 +7,13 @@ import { getCliProgram } from './helpers/cli-program';const program = getCliProgram();program.action(async (url: string, options: PakeCliOptions) => {+ if (!url) {+ program.help({+ error: false,+ });+ return;+ }+log.setDefaultLevel('debug');const appOptions = await handleInputOptions(options, url);diff --git a/bin/helpers/cli-program.ts b/bin/helpers/cli-program.tsindex 5460a8ba..8d84e1ff 100644--- a/bin/helpers/cli-program.ts+++ b/bin/helpers/cli-program.ts@@ -16,6 +16,7 @@ ${green('|_| \\__,_|_|\\_\\___| can turn any webpage into a desktop app withreturn program.addHelpText('beforeAll', logo).usage(`[url] [options]`)+ .helpOption('-h, --help', 'Show all CLI options').showHelpAfterError().argument('[url]', 'The web URL you want to package', validateUrlInput).option('--name <string>', 'Application name')@@ -277,14 +278,19 @@ ${green('|_| \\__,_|_|\\_\\___| can turn any webpage into a desktop app with.version(packageJson.version, '-v, --version').configureHelp({sortSubcommands: true,+ visibleOptions: (command) => {+ const options = [...command.options];+ const helpOption = (command as unknown as { _helpOption?: Option })+ ._helpOption;+ if (helpOption) {+ options.push(helpOption);+ }+ return options;+ },optionTerm: (option) => {- if (option.flags === '-v, --version' || option.flags === '-h, --help')- return '';return option.flags;},optionDescription: (option) => {- if (option.flags === '-v, --version' || option.flags === '-h, --help')- return '';return option.description;},});diff --git a/dist/cli.js b/dist/cli.jsindex 57f4c35a..d6e8dd24 100644--- a/dist/cli.js+++ b/dist/cli.js@@ -2590,6 +2590,7 @@ ${green('|_| \\__,_|_|\\_\\___| can turn any webpage into a desktop app withreturn program$1.addHelpText('beforeAll', logo).usage(`[url] [options]`)+ .helpOption('-h, --help', 'Show all CLI options').showHelpAfterError().argument('[url]', 'The web URL you want to package', validateUrlInput).option('--name <string>', 'Application name')@@ -2729,14 +2730,19 @@ ${green('|_| \\__,_|_|\\_\\___| can turn any webpage into a desktop app with.version(packageJson.version, '-v, --version').configureHelp({sortSubcommands: true,+ visibleOptions: (command) => {+ const options = [...command.options];+ const helpOption = command+ ._helpOption;+ if (helpOption) {+ options.push(helpOption);+ }+ return options;+ },optionTerm: (option) => {- if (option.flags === '-v, --version' || option.flags === '-h, --help')- return '';return option.flags;},optionDescription: (option) => {- if (option.flags === '-v, --version' || option.flags === '-h, --help')- return '';return option.description;},});diff --git a/docs/cli-usage.md b/docs/cli-usage.mdindex b2961415..5c7b794b 100644--- a/docs/cli-usage.md+++ b/docs/cli-usage.md@@ -70,7 +70,7 @@ The URL is the link to the web page you want to package or the path to a local H### [options]-Various options are available for customization. Here are the most commonly used ones:+Various options are available for customization. `pake --help` shows every supported CLI option. This page is the complete reference.| Option | Description | Example || ------------------ | ----------------------------------------------- | ---------------------------------------------- |@@ -80,6 +80,8 @@ Various options are available for customization. Here are the most commonly used| `--height` | Window height (default: 780px) | `--height 900` || `--hide-title-bar` | Immersive header (macOS only) | `--hide-title-bar` || `--debug` | Enable development tools | `--debug` |+| `--help` | Show all CLI options | `--help` |+| `--version` | Show CLI version | `--version` |For complete options, see detailed sections below.diff --git a/docs/cli-usage_CN.md b/docs/cli-usage_CN.mdindex 2a8a49a2..c23db80b 100644--- a/docs/cli-usage_CN.md+++ b/docs/cli-usage_CN.md@@ -70,7 +70,7 @@ pake [url] [options]### [options]-您可以通过传递以下选项来定制打包过程。以下是最常用的选项:+您可以通过传递以下选项来定制打包过程。`pake --help` 展示全部支持的 CLI 选项。本文档是完整参考。| 选项 | 描述 | 示例 || ------------------ | ------------------------------------ | ---------------------------------------------- |@@ -80,6 +80,8 @@ pake [url] [options]| `--height` | 窗口高度(默认:780px) | `--height 900` || `--hide-title-bar` | 沉浸式标题栏(仅macOS) | `--hide-title-bar` || `--debug` | 启用开发者工具 | `--debug` |+| `--help` | 显示全部 CLI 选项 | `--help` |+| `--version` | 显示 CLI 版本 | `--version` |完整选项请参见下面的详细说明:diff --git a/tests/unit/cli-options.test.ts b/tests/unit/cli-options.test.tsindex 85969b66..51dcbe3d 100644--- a/tests/unit/cli-options.test.ts+++ b/tests/unit/cli-options.test.ts@@ -5,6 +5,21 @@ import { validateNumberInput } from '../../bin/utils/validate.js';describe('CLI options', () => {const program = getCliProgram();+ it('shows meta options in help', () => {+ const help = program.helpInformation();++ expect(help).toContain('-h, --help');+ expect(help).toContain('-v, --version');+ });++ it('shows advanced options in help', () => {+ const help = program.helpInformation();++ expect(help).toContain('--enable-find');+ expect(help).toContain('--internal-url-regex');+ expect(help).toContain('--hide-on-close');+ });+it('registers hidden --multi-window option', () => {const option = program.options.find((item) => item.long === '--multi-window',