From 129893c53995c587c50348d0a430293a90a4e6a2 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Thu, 2 Mar 2023 17:47:19 +0800 Subject: [PATCH] :art: Optimizing the user prompts during command usage --- bin/cli.ts | 8 ++++---- bin/helpers/rust.ts | 2 +- bin/options/icon.ts | 2 +- bin/options/index.ts | 2 +- bin/utils/url.ts | 2 +- bin/utils/validate.ts | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/cli.ts b/bin/cli.ts index 9c020b8..2203781 100644 --- a/bin/cli.ts +++ b/bin/cli.ts @@ -9,20 +9,20 @@ import { checkUpdateTips } from './helpers/updater.js'; // @ts-expect-error import packageJson from '../package.json'; -program.version(packageJson.version).description('A cli application can turn any webpage into a desktop app with Rust.'); +program.version(packageJson.version).description('A command-line tool that can quickly convert a webpage into a desktop application.'); program .showHelpAfterError() - .argument('[url]', 'the web url you want to package', validateUrlInput) + .argument('[url]', 'the web URL you want to package', validateUrlInput) .option('-n, --name ', 'application name') .option('-i, --icon ', 'application icon', DEFAULT_PAKE_OPTIONS.icon) .option('-w, --width ', 'window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width) .option('-h, --height ', 'window height', validateNumberInput, DEFAULT_PAKE_OPTIONS.height) - .option('-f, --fullscreen', 'makes the packaged app start in full screen', DEFAULT_PAKE_OPTIONS.fullscreen) + .option('-f, --fullscreen', 'start in full screen mode', DEFAULT_PAKE_OPTIONS.fullscreen) .option('-t, --transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent) .option('-r, --no-resizable', 'whether the window can be resizable', DEFAULT_PAKE_OPTIONS.resizable) .option('-d, --debug', 'debug', DEFAULT_PAKE_OPTIONS.debug) - .option('-m, --multi-arch', "Supports both Intel and m1 chips, only for Mac.", DEFAULT_PAKE_OPTIONS.multiArch) + .option('-m, --multi-arch', "available for Mac only, and supports both Intel and M1", DEFAULT_PAKE_OPTIONS.multiArch) .action(async (url: string, options: PakeCliOptions) => { await checkUpdateTips(); diff --git a/bin/helpers/rust.ts b/bin/helpers/rust.ts index a626818..9e9287a 100644 --- a/bin/helpers/rust.ts +++ b/bin/helpers/rust.ts @@ -13,7 +13,7 @@ export async function installRust() { await shellExec(IS_WIN ? RustInstallScriptForWin : RustInstallScriptFocMac); spinner.succeed(); } catch (error) { - console.error('install rust return code', error.message); + console.error('Error codes that occur during the Rust installation process.', error.message); spinner.fail(); process.exit(1); diff --git a/bin/options/icon.ts b/bin/options/icon.ts index 9fddd2c..2a12b97 100644 --- a/bin/options/icon.ts +++ b/bin/options/icon.ts @@ -22,7 +22,7 @@ export async function handleIcon(options: PakeAppOptions, url: string) { } export async function getDefaultIcon() { - logger.info('You have not provided an app icon, use the default icon.(use --icon option to assign an icon)') + logger.info('You haven\'t provided an app icon, so the default icon will be used. To assign a custom icon, please use the --icon option.') let iconPath = 'src-tauri/icons/icon.icns'; if (IS_WIN) { iconPath = 'src-tauri/png/icon_256.ico'; diff --git a/bin/options/index.ts b/bin/options/index.ts index efcf4f6..921ed59 100644 --- a/bin/options/index.ts +++ b/bin/options/index.ts @@ -11,7 +11,7 @@ export default async function handleOptions(options: PakeCliOptions, url: string }; if (!appOptions.name) { - appOptions.name = await promptText('please input your application name', getDomain(url)); + appOptions.name = await promptText('Please enter the name of your application.', getDomain(url)); } appOptions.identifier = getIdentifier(appOptions.name, url); diff --git a/bin/utils/url.ts b/bin/utils/url.ts index fff707a..a3e4d8e 100644 --- a/bin/utils/url.ts +++ b/bin/utils/url.ts @@ -42,6 +42,6 @@ export function normalizeUrl(urlToNormalize: string): string { if (isurl(urlWithProtocol)) { return urlWithProtocol; } else { - throw new Error(`Your url "${urlWithProtocol}" is invalid`); + throw new Error(`The URL "${urlWithProtocol}" you provided is invalid.`); } } diff --git a/bin/utils/validate.ts b/bin/utils/validate.ts index a97821c..54add5b 100644 --- a/bin/utils/validate.ts +++ b/bin/utils/validate.ts @@ -4,7 +4,7 @@ import { normalizeUrl } from './url.js'; export function validateNumberInput(value: string) { const parsedValue = Number(value); if (isNaN(parsedValue)) { - throw new Commander.InvalidArgumentError('Not a number.'); + throw new Commander.InvalidArgumentError('The input cannot be a number.'); } return parsedValue; }