feat: update ev cli
This commit is contained in:
@@ -48,14 +48,19 @@ type DeleteAppOptions = {
|
||||
id: string;
|
||||
type?: appType;
|
||||
appName?: string;
|
||||
yes?: boolean;
|
||||
};
|
||||
|
||||
export class AppDownload {
|
||||
config: AssistantConfig;
|
||||
constructor(config: AssistantConfig) {
|
||||
this.config = config;
|
||||
}
|
||||
async getRegistry() {
|
||||
return this.config.getRegistry();
|
||||
}
|
||||
async downloadApp(opts: DownloadAppOptions) {
|
||||
const { id, type = 'web', force } = opts;
|
||||
const { id, type = 'web', force, yes } = opts;
|
||||
const configDir = this.config.configDir;
|
||||
this.config?.checkMounted();
|
||||
const appsDir = this.config.configPath?.appsDir;
|
||||
@@ -100,7 +105,7 @@ export class AppDownload {
|
||||
return confirm;
|
||||
}
|
||||
async deleteApp(opts: DeleteAppOptions) {
|
||||
const { id, type = 'web' } = opts;
|
||||
const { id, type = 'web', yes = false } = opts;
|
||||
const appName = opts?.appName || id.split('/').pop();
|
||||
this.config?.checkMounted();
|
||||
const appsDir = this.config.configPath?.appsDir;
|
||||
@@ -119,10 +124,12 @@ export class AppDownload {
|
||||
deletePath = appPath;
|
||||
}
|
||||
if (deletePath && checkFileExists(deletePath)) {
|
||||
const confirm = await this.confirm(`是否删除 ${deletePath} 应用?`);
|
||||
if (!confirm) {
|
||||
console.log('取消删除应用');
|
||||
return;
|
||||
if (!yes) {
|
||||
const confirm = await this.confirm(`是否删除 ${deletePath} 应用?`);
|
||||
if (!confirm) {
|
||||
console.log('取消删除应用');
|
||||
return;
|
||||
}
|
||||
}
|
||||
fs.rmSync(deletePath, { recursive: true });
|
||||
isDelete = true;
|
||||
|
||||
Reference in New Issue
Block a user