contextswitch 0.1.1 → 0.1.3
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/cli.js +12 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -11,15 +11,17 @@ import "./chunk-PNKVD2UK.js";
|
|
|
11
11
|
import { Command } from "commander";
|
|
12
12
|
import picocolors from "picocolors";
|
|
13
13
|
import { existsSync, readFileSync, unlinkSync } from "fs";
|
|
14
|
-
import { join } from "path";
|
|
14
|
+
import { join, dirname } from "path";
|
|
15
|
+
import { fileURLToPath } from "url";
|
|
15
16
|
var pc = picocolors;
|
|
16
17
|
function getVersion() {
|
|
17
18
|
try {
|
|
18
|
-
const
|
|
19
|
+
const currentDir = typeof __dirname !== "undefined" ? __dirname : dirname(fileURLToPath(import.meta.url));
|
|
20
|
+
const packagePath = join(currentDir, "..", "package.json");
|
|
19
21
|
const packageJson = JSON.parse(readFileSync(packagePath, "utf-8"));
|
|
20
22
|
return packageJson.version;
|
|
21
23
|
} catch {
|
|
22
|
-
return "0.1.
|
|
24
|
+
return "0.1.3";
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
function processSessionFallbackMarker() {
|
|
@@ -151,7 +153,7 @@ program.command("archive <domain>").description("Archive the current session for
|
|
|
151
153
|
await archiveCommand(domain);
|
|
152
154
|
});
|
|
153
155
|
var domainCmd = program.command("domain").description("Manage domains");
|
|
154
|
-
domainCmd.command("add <name>").description('Create a new domain\n\nExamples:\n cs domain add myapi --working-dir
|
|
156
|
+
domainCmd.command("add <name>").description('Create a new domain\n\nExamples:\n cs domain add myapi --working-dir /path/to/project\n cs domain add frontend -w C:\\Users\\you\\app -d "React frontend"\n\nIf --working-dir is not specified, the current directory is used.').option("-w, --working-dir <path>", "Working directory for this domain (defaults to current directory)").option("-d, --description <text>", "Domain description").option("--extends <parent>", "Inherit from parent domain").action(async (name, options) => {
|
|
155
157
|
try {
|
|
156
158
|
if (configManager.domainExists(name)) {
|
|
157
159
|
console.error(pc.red(`\u274C Domain '${name}' already exists`));
|
|
@@ -226,6 +228,9 @@ program.command("doctor").description("Check system configuration and diagnose i
|
|
|
226
228
|
console.log(pc.green(`\u2713 Platform: ${paths.platform}`));
|
|
227
229
|
console.log(pc.cyan("\n\u2728 All checks passed!"));
|
|
228
230
|
});
|
|
231
|
+
program.action(() => {
|
|
232
|
+
program.outputHelp();
|
|
233
|
+
});
|
|
229
234
|
program.exitOverride((err) => {
|
|
230
235
|
if (err.code === "commander.helpDisplayed") {
|
|
231
236
|
process.exit(0);
|
|
@@ -233,6 +238,9 @@ program.exitOverride((err) => {
|
|
|
233
238
|
if (err.code === "commander.version") {
|
|
234
239
|
process.exit(0);
|
|
235
240
|
}
|
|
241
|
+
if (err.code === "commander.help") {
|
|
242
|
+
process.exit(0);
|
|
243
|
+
}
|
|
236
244
|
console.error(pc.red(`Error: ${err.message}`));
|
|
237
245
|
process.exit(1);
|
|
238
246
|
});
|