🎨 Optimizing the user prompts during command usage
This commit is contained in:
8
bin/cli.ts
vendored
8
bin/cli.ts
vendored
@@ -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 <string>', 'application name')
|
||||
.option('-i, --icon <string>', 'application icon', DEFAULT_PAKE_OPTIONS.icon)
|
||||
.option('-w, --width <number>', 'window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width)
|
||||
.option('-h, --height <number>', '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();
|
||||
|
||||
2
bin/helpers/rust.ts
vendored
2
bin/helpers/rust.ts
vendored
@@ -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);
|
||||
|
||||
2
bin/options/icon.ts
vendored
2
bin/options/icon.ts
vendored
@@ -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';
|
||||
|
||||
2
bin/options/index.ts
vendored
2
bin/options/index.ts
vendored
@@ -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);
|
||||
|
||||
2
bin/utils/url.ts
vendored
2
bin/utils/url.ts
vendored
@@ -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.`);
|
||||
}
|
||||
}
|
||||
|
||||
2
bin/utils/validate.ts
vendored
2
bin/utils/validate.ts
vendored
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user