cloudburn 0.8.3 → 0.8.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 +19 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
|
-
import {
|
|
4
|
+
import { realpathSync } from "fs";
|
|
5
|
+
import { resolve as resolve2 } from "path";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
5
7
|
|
|
6
8
|
// src/completion/engine.ts
|
|
7
9
|
var buildCompletionTree = (command) => {
|
|
@@ -1346,9 +1348,22 @@ var registerScanCommand = (program) => {
|
|
|
1346
1348
|
};
|
|
1347
1349
|
|
|
1348
1350
|
// src/cli.ts
|
|
1351
|
+
var resolveEntrypointPath = (entrypointPath) => {
|
|
1352
|
+
try {
|
|
1353
|
+
return realpathSync.native(entrypointPath);
|
|
1354
|
+
} catch {
|
|
1355
|
+
return resolve2(entrypointPath);
|
|
1356
|
+
}
|
|
1357
|
+
};
|
|
1358
|
+
var isCliEntrypoint = (moduleUrl, argvEntry = process.argv[1]) => {
|
|
1359
|
+
if (argvEntry === void 0) {
|
|
1360
|
+
return false;
|
|
1361
|
+
}
|
|
1362
|
+
return resolveEntrypointPath(fileURLToPath(moduleUrl)) === resolveEntrypointPath(argvEntry);
|
|
1363
|
+
};
|
|
1349
1364
|
var createProgram = () => {
|
|
1350
1365
|
const program = createCliCommand();
|
|
1351
|
-
program.name("cloudburn").usage("[command]").description("Know what you spend. Fix what you waste.").version("0.8.
|
|
1366
|
+
program.name("cloudburn").usage("[command]").description("Know what you spend. Fix what you waste.").version("0.8.4").option("--format <format>", OUTPUT_FORMAT_OPTION_DESCRIPTION, parseOutputFormat);
|
|
1352
1367
|
configureCliHelp(program);
|
|
1353
1368
|
registerCompletionCommand(program);
|
|
1354
1369
|
registerDiscoverCommand(program);
|
|
@@ -1361,11 +1376,11 @@ var createProgram = () => {
|
|
|
1361
1376
|
var runCli = async () => {
|
|
1362
1377
|
await createProgram().parseAsync(process.argv);
|
|
1363
1378
|
};
|
|
1364
|
-
|
|
1365
|
-
if (isMain) {
|
|
1379
|
+
if (isCliEntrypoint(import.meta.url)) {
|
|
1366
1380
|
await runCli();
|
|
1367
1381
|
}
|
|
1368
1382
|
export {
|
|
1369
1383
|
createProgram,
|
|
1384
|
+
isCliEntrypoint,
|
|
1370
1385
|
runCli
|
|
1371
1386
|
};
|