feat: migrate from inquirer to @inquirer/prompts for interactive prompts
- Replaced inquirer with @inquirer/prompts in various command files for improved prompt handling. - Updated confirmation and input prompts in commands such as app, config, deploy, login, and others. - Added a new command 'cc' for switching between Claude code models with appropriate configurations. - Enhanced user experience by ensuring prompts are more streamlined and consistent across the application.
This commit is contained in:
@@ -10,7 +10,7 @@ import { fileIsExist } from '@/uitls/file.ts';
|
||||
import fs from 'fs';
|
||||
import { getConfig } from '@/module/get-config.ts';
|
||||
import path from 'path';
|
||||
import inquirer from 'inquirer';
|
||||
import { confirm } from '@inquirer/prompts';
|
||||
import { baseURL, getUrl } from '@/module/query.ts';
|
||||
export const appCommand = new Command('app').description('app 命令').action(() => {
|
||||
console.log('app');
|
||||
@@ -99,15 +99,11 @@ const uninstallAppCommand = new Command('uninstall')
|
||||
if (!checkPath) {
|
||||
console.error(chalk.red('path is error, 请输入正确的路径'));
|
||||
} else {
|
||||
const answer = await inquirer.prompt([
|
||||
{
|
||||
type: 'confirm',
|
||||
name: 'confirm',
|
||||
message: `确定要删除 ${_path} 吗?`,
|
||||
default: false,
|
||||
},
|
||||
]);
|
||||
if (answer.confirm) {
|
||||
const confirmed = await confirm({
|
||||
message: `确定要删除 ${_path} 吗?`,
|
||||
default: false,
|
||||
});
|
||||
if (confirmed) {
|
||||
fs.rmSync(_path, { recursive: true });
|
||||
console.log(chalk.green('删除成功', _path));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user