🎨 Simplify the use of cli
This commit is contained in:
26
bin/cli.ts
vendored
26
bin/cli.ts
vendored
@@ -3,7 +3,7 @@ import { program, Option } from 'commander';
|
||||
import log from 'loglevel';
|
||||
import packageJson from '../package.json';
|
||||
import BuilderProvider from './builders/BuilderProvider';
|
||||
import { DEFAULT_PAKE_OPTIONS as DEFAULT } from './defaults';
|
||||
import { DEFAULT_PAKE_OPTIONS as DEFAULT, DEFAULT_PAKE_OPTIONS } from './defaults';
|
||||
import { checkUpdateTips } from './helpers/updater';
|
||||
import handleInputOptions from './options/index';
|
||||
|
||||
@@ -28,31 +28,23 @@ program
|
||||
.option('--height <number>', 'Window height', validateNumberInput, DEFAULT.height)
|
||||
.option('--use-local-file', 'Use local file packaging', DEFAULT.useLocalFile)
|
||||
.option('--fullscreen', 'Start in full screen', DEFAULT.fullscreen)
|
||||
.option('--hide-title-bar', 'Only for Mac, hide title bar', DEFAULT.hideTitleBar)
|
||||
.option('--activation-shortcut <string>', 'Shortcut key to active App', DEFAULT.activationShortcut)
|
||||
.option('--hide-title-bar', 'For Mac, hide title bar', DEFAULT.hideTitleBar)
|
||||
.option('--multi-arch', 'For Mac, both Intel and M1', DEFAULT.multiArch)
|
||||
.option('--inject <url>', 'Injection of .js or .css files', DEFAULT.inject)
|
||||
.option('--proxy-url <url>', "Proxy URL for all network requests", DEFAULT.proxyUrl)
|
||||
.option('--debug', 'Debug build and more output', DEFAULT.debug)
|
||||
.option('--multi-arch', 'Only for Mac, supports both Intel and M1', DEFAULT.multiArch)
|
||||
.addOption(new Option('--proxy-url <url>', 'Proxy URL for all network requests').default(DEFAULT_PAKE_OPTIONS.proxyUrl).hideHelp())
|
||||
.addOption(new Option('--user-agent <string>', 'Custom user agent').default(DEFAULT.userAgent).hideHelp())
|
||||
.addOption(
|
||||
new Option('--targets <string>', 'Only for Linux, option "deb" or "appimage"').default(DEFAULT.targets).hideHelp(),
|
||||
)
|
||||
.addOption(new Option('--targets <string>', 'For Linux, option "deb" or "appimage"').default(DEFAULT.targets).hideHelp())
|
||||
.addOption(new Option('--app-version <string>', 'App version, the same as package.json version').default(DEFAULT.appVersion).hideHelp())
|
||||
.addOption(new Option('--always-on-top', 'Always on the top level').default(DEFAULT.alwaysOnTop).hideHelp())
|
||||
.addOption(new Option('--dark-mode', 'Force Mac app to use dark mode').default(DEFAULT.darkMode).hideHelp())
|
||||
.addOption(new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts').default(DEFAULT.disabledWebShortcuts).hideHelp())
|
||||
.addOption(
|
||||
new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts')
|
||||
.default(DEFAULT.disabledWebShortcuts)
|
||||
.hideHelp(),
|
||||
new Option('--activation-shortcut <string>', 'Shortcut key to active App').default(DEFAULT_PAKE_OPTIONS.activationShortcut).hideHelp(),
|
||||
)
|
||||
.addOption(new Option('--show-system-tray', 'Show system tray in app').default(DEFAULT.showSystemTray).hideHelp())
|
||||
.addOption(
|
||||
new Option('--system-tray-icon <string>', 'Custom system tray icon').default(DEFAULT.systemTrayIcon).hideHelp(),
|
||||
)
|
||||
.addOption(
|
||||
new Option('--installer-language <string>', 'Installer language').default(DEFAULT.installerLanguage).hideHelp(),
|
||||
)
|
||||
.addOption(new Option('--system-tray-icon <string>', 'Custom system tray icon').default(DEFAULT.systemTrayIcon).hideHelp())
|
||||
.addOption(new Option('--installer-language <string>', 'Installer language').default(DEFAULT.installerLanguage).hideHelp())
|
||||
.version(packageJson.version, '-v, --version', 'Output the current version')
|
||||
.action(async (url: string, options: PakeCliOptions) => {
|
||||
await checkUpdateTips();
|
||||
|
||||
Reference in New Issue
Block a user