update python.ts
This commit is contained in:
@@ -19,8 +19,8 @@ const PYTHON_VENV_DEFAULT_BASE_DIR = "~/.venv/";
|
|||||||
|
|
||||||
interface PythonConfig {
|
interface PythonConfig {
|
||||||
python_venv_base_path?: string;
|
python_venv_base_path?: string;
|
||||||
versions: Map<string, PythonVersion>;
|
versions: Record<string, PythonVersion>;
|
||||||
profiles?: Map<string, PythonVenv>;
|
profiles?: Record<string, PythonVenv>;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PythonVersion {
|
interface PythonVersion {
|
||||||
@@ -377,21 +377,22 @@ python.ts remove-venv --venv test-env`);
|
|||||||
pythonVenvProfile,
|
pythonVenvProfile,
|
||||||
);
|
);
|
||||||
|
|
||||||
const yesOrNo = prompt("Please confirm (yes/no):");
|
if (confirm("Please confirm:")) {
|
||||||
if (yesOrNo === "yes" || yesOrNo === "y") {
|
|
||||||
const path = pythonVenvProfile.path;
|
const path = pythonVenvProfile.path;
|
||||||
log.info(`Remove path: ${path}`);
|
log.info(`Remove path: ${path}`);
|
||||||
await new ProcessBar(`Removing path ${path}`).call(async () => {
|
await new ProcessBar(`Removing path ${path}`).call(async () => {
|
||||||
await Deno.remove(path, { recursive: true });
|
await Deno.remove(path, { recursive: true });
|
||||||
});
|
});
|
||||||
|
if (pythonConfig.profiles) {
|
||||||
delete pythonConfig.profiles[flags.venv];
|
delete pythonConfig.profiles[flags.venv];
|
||||||
|
}
|
||||||
await savePythonConfig(pythonConfig);
|
await savePythonConfig(pythonConfig);
|
||||||
log.success(
|
log.success(
|
||||||
`Virtual environment: '${flags.venv}' removed, path: ${path}`,
|
`Virtual environment: '${flags.venv}' removed, path: ${path}`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log(
|
||||||
`Your input '${yesOrNo}', skip remove the virtual environment`,
|
`Your skip virtual environment removal`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -474,5 +475,5 @@ async function main() {
|
|||||||
|
|
||||||
main().catch((e) => log.error(e));
|
main().catch((e) => log.error(e));
|
||||||
|
|
||||||
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260125T224529+08:00.MEUCIQCxxJGIlQDOd0HEbsC0
|
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260126T003238+08:00.MEYCIQDwBR9b75cKiOgaUUP3
|
||||||
// 1WCLBtgT7T2TMyTgs9TMCWw97QIgINUQ6SNPJ0NePXi12pp66pCoxh37VqSqaE9TURldmNs=
|
// Jt4TPZBF2CDBh1cKKC4MgNSWNwIhAINFBhTxBWfomgo9uYcAYpYBM4ngc/F/jrAV+hnnO0/H
|
||||||
|
|||||||
Reference in New Issue
Block a user