@aravhawk/cc-switch 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -197,6 +197,9 @@ async function renameProfile(oldName, newName) {
|
|
|
197
197
|
if (!await profileExists(oldName)) {
|
|
198
198
|
throw new Error(`Profile "${oldName}" does not exist`);
|
|
199
199
|
}
|
|
200
|
+
if (oldName === newName) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
200
203
|
if (await profileExists(newName)) {
|
|
201
204
|
throw new Error(`Profile "${newName}" already exists`);
|
|
202
205
|
}
|
|
@@ -366,6 +369,10 @@ async function interactiveMode() {
|
|
|
366
369
|
clack.cancel("Operation cancelled");
|
|
367
370
|
process.exit(0);
|
|
368
371
|
}
|
|
372
|
+
if (oldName === newName) {
|
|
373
|
+
clack.outro("Profile name unchanged");
|
|
374
|
+
process.exit(0);
|
|
375
|
+
}
|
|
369
376
|
await renameProfile(oldName, newName);
|
|
370
377
|
clack.outro(`Renamed profile "${oldName}" to "${newName}"`);
|
|
371
378
|
break;
|
|
@@ -483,6 +490,12 @@ async function runCli() {
|
|
|
483
490
|
if (!newName) {
|
|
484
491
|
throw new Error("Missing new profile name for --rename");
|
|
485
492
|
}
|
|
493
|
+
if (oldName === newName) {
|
|
494
|
+
await renameProfile(oldName, newName);
|
|
495
|
+
console.log("Profile name unchanged");
|
|
496
|
+
process.exit(0);
|
|
497
|
+
break;
|
|
498
|
+
}
|
|
486
499
|
await renameProfile(oldName, newName);
|
|
487
500
|
console.log(`Renamed profile "${oldName}" to "${newName}"`);
|
|
488
501
|
process.exit(0);
|