diffx-cli 0.3.0 → 0.4.0
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.mjs +30 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { parseArgs } from "node:util";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { basename, dirname, extname, join, resolve } from "node:path";
|
|
5
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
6
|
import getPort from "get-port";
|
|
6
7
|
import { execSync } from "node:child_process";
|
|
7
|
-
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
8
8
|
import { readFile } from "node:fs/promises";
|
|
9
9
|
import { Hono } from "hono";
|
|
10
10
|
import { serve } from "@hono/node-server";
|
|
@@ -244,10 +244,39 @@ const { values, positionals } = parseArgs({
|
|
|
244
244
|
"no-open": {
|
|
245
245
|
type: "boolean",
|
|
246
246
|
default: false
|
|
247
|
+
},
|
|
248
|
+
help: { type: "boolean" },
|
|
249
|
+
version: {
|
|
250
|
+
type: "boolean",
|
|
251
|
+
short: "v"
|
|
247
252
|
}
|
|
248
253
|
},
|
|
249
254
|
allowPositionals: true
|
|
250
255
|
});
|
|
256
|
+
if (values.help) {
|
|
257
|
+
console.log(`diffx - Local code review tool for git diffs
|
|
258
|
+
|
|
259
|
+
Usage: diffx [options] [-- <git diff args>]
|
|
260
|
+
|
|
261
|
+
Options:
|
|
262
|
+
-p, --port <port> Port to run the server on (default: 3433)
|
|
263
|
+
--no-open Don't open the browser automatically
|
|
264
|
+
-v, --version Show version number
|
|
265
|
+
-h, --help Show this help message
|
|
266
|
+
|
|
267
|
+
Examples:
|
|
268
|
+
diffx Review uncommitted changes
|
|
269
|
+
diffx -- --staged Review staged changes
|
|
270
|
+
diffx -- HEAD~3 Review last 3 commits
|
|
271
|
+
diffx -- main..feature Compare branches`);
|
|
272
|
+
process.exit(0);
|
|
273
|
+
}
|
|
274
|
+
if (values.version) {
|
|
275
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
276
|
+
const pkg = JSON.parse(readFileSync(resolve(__dirname, "..", "package.json"), "utf-8"));
|
|
277
|
+
console.log(pkg.version);
|
|
278
|
+
process.exit(0);
|
|
279
|
+
}
|
|
251
280
|
const customDiffArgs = positionals.length > 0 ? positionals : void 0;
|
|
252
281
|
if (!isGitRepo()) {
|
|
253
282
|
console.error("Error: not inside a git repository");
|