flashtrace 0.4.0 → 0.4.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/flashtrace.mjs +9 -1
- package/package.json +1 -1
package/dist/flashtrace.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import process4 from "node:process";
|
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
7
|
|
|
8
8
|
// src/cli.mjs
|
|
9
|
-
import { promises as fs2 } from "node:fs";
|
|
9
|
+
import { promises as fs2, readFileSync } from "node:fs";
|
|
10
10
|
import path4 from "node:path";
|
|
11
11
|
import process3 from "node:process";
|
|
12
12
|
|
|
@@ -548,8 +548,13 @@ Options:
|
|
|
548
548
|
-t, --tags <t1,t2,...> only import markdown items carrying one of these
|
|
549
549
|
tags; add "_" to also include untagged items
|
|
550
550
|
-h, --help show this help
|
|
551
|
+
-v, --version print the version number
|
|
551
552
|
|
|
552
553
|
Exit codes: 0 clean, 1 defects or problems found, 2 usage error`;
|
|
554
|
+
function packageVersion() {
|
|
555
|
+
const pkg = new URL("../package.json", import.meta.url);
|
|
556
|
+
return JSON.parse(readFileSync(pkg, "utf8")).version;
|
|
557
|
+
}
|
|
553
558
|
function parseArgs(argv) {
|
|
554
559
|
const opts = { dirs: [], tags: null };
|
|
555
560
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -557,6 +562,9 @@ function parseArgs(argv) {
|
|
|
557
562
|
if (a === "-h" || a === "--help") {
|
|
558
563
|
console.log(HELP);
|
|
559
564
|
process3.exit(0);
|
|
565
|
+
} else if (a === "-v" || a === "--version") {
|
|
566
|
+
console.log(packageVersion());
|
|
567
|
+
process3.exit(0);
|
|
560
568
|
} else if (a === "-t" || a === "--tags") {
|
|
561
569
|
const v = argv[++i];
|
|
562
570
|
if (!v) throw new UsageError(`missing value for ${a}`);
|