@dzhng/crm.cli 0.3.3 → 0.3.4
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 +24 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3261,7 +3261,12 @@ function getDaemonArgs() {
|
|
|
3261
3261
|
if (!script) {
|
|
3262
3262
|
return [];
|
|
3263
3263
|
}
|
|
3264
|
-
|
|
3264
|
+
let resolved;
|
|
3265
|
+
try {
|
|
3266
|
+
resolved = realpathSync(script);
|
|
3267
|
+
} catch {
|
|
3268
|
+
return [];
|
|
3269
|
+
}
|
|
3265
3270
|
if (/\.[tj]s$/.test(resolved)) {
|
|
3266
3271
|
return [resolved];
|
|
3267
3272
|
}
|
|
@@ -3497,6 +3502,23 @@ function registerFuseCommands(program) {
|
|
|
3497
3502
|
program.command("mount").description("Mount CRM as virtual filesystem").argument("[mountpoint]", "Mount point directory").option("--readonly", "Mount read-only").action(async (mountpoint, opts) => {
|
|
3498
3503
|
const { config } = await getCtx();
|
|
3499
3504
|
const mp = mountpoint || config.mount.default_path;
|
|
3505
|
+
const pidFile = join3(tmpdir(), `crm-mount-${slugify(mp)}.pid`);
|
|
3506
|
+
if (existsSync3(pidFile)) {
|
|
3507
|
+
const pids = readFileSync2(pidFile, "utf-8").trim().split(`
|
|
3508
|
+
`);
|
|
3509
|
+
const alive = pids.some((pid) => {
|
|
3510
|
+
try {
|
|
3511
|
+
process.kill(Number(pid), 0);
|
|
3512
|
+
return true;
|
|
3513
|
+
} catch {
|
|
3514
|
+
return false;
|
|
3515
|
+
}
|
|
3516
|
+
});
|
|
3517
|
+
if (alive) {
|
|
3518
|
+
die(`Error: ${mp} is already mounted. Run \`crm unmount ${mp}\` first.`);
|
|
3519
|
+
}
|
|
3520
|
+
unlinkSync(pidFile);
|
|
3521
|
+
}
|
|
3500
3522
|
if (!existsSync3(mp)) {
|
|
3501
3523
|
mkdirSync4(mp, { recursive: true });
|
|
3502
3524
|
}
|
|
@@ -5425,7 +5447,7 @@ if (process.argv[1]?.endsWith("fuse-daemon.ts")) {
|
|
|
5425
5447
|
|
|
5426
5448
|
// src/cli.ts
|
|
5427
5449
|
var program = new Command;
|
|
5428
|
-
program.name("crm").description("Headless CLI-first CRM").version("0.3.
|
|
5450
|
+
program.name("crm").description("Headless CLI-first CRM").version("0.3.4");
|
|
5429
5451
|
program.exitOverride();
|
|
5430
5452
|
registerContactCommands(program);
|
|
5431
5453
|
registerCompanyCommands(program);
|