watskeburt 4.0.1 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cli.js +51 -51
- package/dist/format/format.js +3 -3
- package/dist/format/json.js +1 -1
- package/dist/format/regex.js +34 -34
- package/dist/git-primitives.js +72 -72
- package/dist/main.js +20 -20
- package/dist/map-change-type.js +12 -12
- package/dist/parse-diff-lines.js +18 -18
- package/dist/parse-status-lines.js +23 -23
- package/dist/version.js +1 -1
- package/package.json +51 -51
- package/types/watskeburt.d.ts +48 -48
package/dist/cli.js
CHANGED
@@ -14,60 +14,60 @@ Options:
|
|
14
14
|
-V, --version output the version number
|
15
15
|
-h, --help display help for command${EOL}`;
|
16
16
|
export async function cli(
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
pArguments = process.argv.slice(2),
|
18
|
+
pOutStream = process.stdout,
|
19
|
+
pErrorStream = process.stderr,
|
20
|
+
pErrorExitCode = 1,
|
21
21
|
) {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
22
|
+
try {
|
23
|
+
const lArguments = getArguments(pArguments);
|
24
|
+
if (lArguments.values.help) {
|
25
|
+
pOutStream.write(HELP_MESSAGE);
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
if (lArguments.values.version) {
|
29
|
+
pOutStream.write(`${VERSION}${EOL}`);
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
if (!outputTypeIsValid(lArguments.values.outputType)) {
|
33
|
+
pErrorStream.write(
|
34
|
+
`error: option '-T, --outputType <type>' argument '${lArguments.values.outputType}' is invalid. Allowed choices are json, regex.${EOL}`,
|
35
|
+
);
|
36
|
+
process.exitCode = pErrorExitCode;
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
const lResult = await list({
|
40
|
+
...lArguments.values,
|
41
|
+
oldRevision: lArguments.positionals[0],
|
42
|
+
newRevision: lArguments.positionals[1],
|
43
|
+
});
|
44
|
+
pOutStream.write(`${lResult}${EOL}`);
|
45
|
+
} catch (pError) {
|
46
|
+
pErrorStream.write(`${EOL}ERROR: ${pError.message}${EOL}${EOL}`);
|
47
|
+
process.exitCode = pErrorExitCode;
|
48
|
+
}
|
49
49
|
}
|
50
50
|
function getArguments(pArguments) {
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
51
|
+
return parseArgs({
|
52
|
+
args: pArguments,
|
53
|
+
options: {
|
54
|
+
outputType: {
|
55
|
+
type: "string",
|
56
|
+
short: "T",
|
57
|
+
default: "regex",
|
58
|
+
},
|
59
|
+
trackedOnly: {
|
60
|
+
type: "boolean",
|
61
|
+
default: false,
|
62
|
+
},
|
63
|
+
help: { type: "boolean", short: "h", default: false },
|
64
|
+
version: { type: "boolean", short: "V", default: false },
|
65
|
+
},
|
66
|
+
strict: true,
|
67
|
+
allowPositionals: true,
|
68
|
+
tokens: false,
|
69
|
+
});
|
70
70
|
}
|
71
71
|
function outputTypeIsValid(pOutputType) {
|
72
|
-
|
72
|
+
return ["json", "regex"].includes(pOutputType);
|
73
73
|
}
|
package/dist/format/format.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import formatAsRegex from "./regex.js";
|
2
2
|
import formatAsJSON from "./json.js";
|
3
3
|
const OUTPUT_TYPE_TO_FUNCTION = new Map([
|
4
|
-
|
5
|
-
|
4
|
+
["regex", formatAsRegex],
|
5
|
+
["json", formatAsJSON],
|
6
6
|
]);
|
7
7
|
export function format(pChanges, pOutputType) {
|
8
|
-
|
8
|
+
return OUTPUT_TYPE_TO_FUNCTION.get(pOutputType)(pChanges);
|
9
9
|
}
|
package/dist/format/json.js
CHANGED
package/dist/format/regex.js
CHANGED
@@ -1,42 +1,42 @@
|
|
1
1
|
import { extname } from "node:path";
|
2
2
|
const DEFAULT_EXTENSIONS = new Set([
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
3
|
+
".cjs",
|
4
|
+
".cjsx",
|
5
|
+
".coffee",
|
6
|
+
".csx",
|
7
|
+
".cts",
|
8
|
+
".js",
|
9
|
+
".json",
|
10
|
+
".jsx",
|
11
|
+
".litcoffee",
|
12
|
+
".ls",
|
13
|
+
".mjs",
|
14
|
+
".mts",
|
15
|
+
".svelte",
|
16
|
+
".ts",
|
17
|
+
".tsx",
|
18
|
+
".vue",
|
19
|
+
".vuex",
|
20
20
|
]);
|
21
21
|
const DEFAULT_CHANGE_TYPES = new Set([
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
"modified",
|
23
|
+
"added",
|
24
|
+
"renamed",
|
25
|
+
"copied",
|
26
|
+
"untracked",
|
27
27
|
]);
|
28
28
|
export default function formatAsRegex(
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
pChanges,
|
30
|
+
pExtensions = DEFAULT_EXTENSIONS,
|
31
|
+
pChangeTypes = DEFAULT_CHANGE_TYPES,
|
32
32
|
) {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
33
|
+
const lChanges = pChanges
|
34
|
+
.filter(
|
35
|
+
(pChange) =>
|
36
|
+
pChangeTypes.has(pChange.type) &&
|
37
|
+
pExtensions.has(extname(pChange.name)),
|
38
|
+
)
|
39
|
+
.map(({ name }) => name.replace(/\\/g, "\\\\").replace(/\./g, "[.]"))
|
40
|
+
.join("|");
|
41
|
+
return `^(${lChanges})$`;
|
42
42
|
}
|
package/dist/git-primitives.js
CHANGED
@@ -1,84 +1,84 @@
|
|
1
1
|
import { spawn } from "node:child_process";
|
2
2
|
export async function getStatusShort(pSpawnFunction = spawn) {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
3
|
+
const lErrorMap = new Map([
|
4
|
+
[129, `'${process.cwd()}' does not seem to be a git repository`],
|
5
|
+
]);
|
6
|
+
const lResult = await getGitResult(
|
7
|
+
["status", "--porcelain"],
|
8
|
+
lErrorMap,
|
9
|
+
pSpawnFunction,
|
10
|
+
);
|
11
|
+
return lResult;
|
12
12
|
}
|
13
13
|
export async function getDiffLines(
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
pOldRevision,
|
15
|
+
pNewRevision,
|
16
|
+
pSpawnFunction = spawn,
|
17
17
|
) {
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
18
|
+
const lErrorMap = new Map([
|
19
|
+
[
|
20
|
+
128,
|
21
|
+
`revision '${pOldRevision}' ${pNewRevision ? `(or '${pNewRevision}') ` : ""}unknown`,
|
22
|
+
],
|
23
|
+
[129, `'${process.cwd()}' does not seem to be a git repository`],
|
24
|
+
]);
|
25
|
+
const lResult = await getGitResult(
|
26
|
+
pNewRevision
|
27
|
+
? ["diff", pOldRevision, pNewRevision, "--name-status"]
|
28
|
+
: ["diff", pOldRevision, "--name-status"],
|
29
|
+
lErrorMap,
|
30
|
+
pSpawnFunction,
|
31
|
+
);
|
32
|
+
return lResult;
|
33
33
|
}
|
34
34
|
export async function getSHA(pSpawnFunction = spawn) {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
const lSha1Length = 40;
|
36
|
+
const lResult = await getGitResult(
|
37
|
+
["rev-parse", "HEAD"],
|
38
|
+
new Map(),
|
39
|
+
pSpawnFunction,
|
40
|
+
);
|
41
|
+
return lResult.slice(0, lSha1Length);
|
42
42
|
}
|
43
43
|
function getGitResult(pArguments, pErrorMap, pSpawnFunction) {
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
44
|
+
const lGit = pSpawnFunction("git", pArguments, {
|
45
|
+
cwd: process.cwd(),
|
46
|
+
env: process.env,
|
47
|
+
});
|
48
|
+
let lStdOutData = "";
|
49
|
+
let lStdErrorData = "";
|
50
|
+
return new Promise((pResolve, pReject) => {
|
51
|
+
lGit.stdout?.on("data", (pData) => {
|
52
|
+
lStdOutData = lStdOutData.concat(pData);
|
53
|
+
});
|
54
|
+
lGit.stderr?.on("data", (pData) => {
|
55
|
+
lStdErrorData = lStdErrorData.concat(pData);
|
56
|
+
});
|
57
|
+
lGit.on("close", (pCode) => {
|
58
|
+
if (pCode === 0) {
|
59
|
+
pResolve(stringifyOutStream(lStdOutData));
|
60
|
+
} else {
|
61
|
+
pReject(
|
62
|
+
new Error(
|
63
|
+
pErrorMap.get(pCode ?? 0) ||
|
64
|
+
`internal git error: ${pCode} (${stringifyOutStream(lStdErrorData)})`,
|
65
|
+
),
|
66
|
+
);
|
67
|
+
}
|
68
|
+
});
|
69
|
+
lGit.on("error", (pError) => {
|
70
|
+
if (pError?.code === "ENOENT") {
|
71
|
+
pReject(new Error("git executable not found"));
|
72
|
+
} else {
|
73
|
+
pReject(new Error(`internal spawn error: ${pError}`));
|
74
|
+
}
|
75
|
+
});
|
76
|
+
});
|
77
77
|
}
|
78
78
|
function stringifyOutStream(pBufferOrString) {
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
79
|
+
if (pBufferOrString instanceof Buffer) {
|
80
|
+
return pBufferOrString.toString("utf8");
|
81
|
+
} else {
|
82
|
+
return pBufferOrString;
|
83
|
+
}
|
84
84
|
}
|
package/dist/main.js
CHANGED
@@ -2,26 +2,26 @@ import { parseDiffLines } from "./parse-diff-lines.js";
|
|
2
2
|
import { parseStatusLines } from "./parse-status-lines.js";
|
3
3
|
import * as primitives from "./git-primitives.js";
|
4
4
|
export async function list(pOptions) {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
5
|
+
const lOldRevision = pOptions?.oldRevision || (await primitives.getSHA());
|
6
|
+
const lOptions = pOptions || {};
|
7
|
+
const [lDiffLines, lStatusLines] = await Promise.all([
|
8
|
+
primitives.getDiffLines(lOldRevision, pOptions?.newRevision),
|
9
|
+
!lOptions.trackedOnly ? primitives.getStatusShort() : "",
|
10
|
+
]);
|
11
|
+
let lChanges = parseDiffLines(lDiffLines);
|
12
|
+
if (!lOptions.trackedOnly) {
|
13
|
+
lChanges = lChanges.concat(
|
14
|
+
parseStatusLines(lStatusLines).filter(
|
15
|
+
({ type: changeType }) => changeType === "untracked",
|
16
|
+
),
|
17
|
+
);
|
18
|
+
}
|
19
|
+
if (!lOptions.outputType) {
|
20
|
+
return lChanges;
|
21
|
+
}
|
22
|
+
const { format } = await import("./format/format.js");
|
23
|
+
return format(lChanges, lOptions.outputType);
|
24
24
|
}
|
25
25
|
export function getSHA() {
|
26
|
-
|
26
|
+
return primitives.getSHA();
|
27
27
|
}
|
package/dist/map-change-type.js
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
const CHANGE_CHAR_2_CHANGE_TYPE = new Map([
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
["A", "added"],
|
3
|
+
["C", "copied"],
|
4
|
+
["D", "deleted"],
|
5
|
+
["M", "modified"],
|
6
|
+
["R", "renamed"],
|
7
|
+
["T", "type changed"],
|
8
|
+
["U", "unmerged"],
|
9
|
+
["B", "pairing broken"],
|
10
|
+
[" ", "unmodified"],
|
11
|
+
["?", "untracked"],
|
12
|
+
["!", "ignored"],
|
13
13
|
]);
|
14
14
|
export function changeChar2ChangeType(pChar) {
|
15
|
-
|
15
|
+
return CHANGE_CHAR_2_CHANGE_TYPE.get(pChar) ?? "unknown";
|
16
16
|
}
|
package/dist/parse-diff-lines.js
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
import { EOL } from "node:os";
|
2
2
|
import { changeChar2ChangeType } from "./map-change-type.js";
|
3
3
|
const DIFF_NAME_STATUS_LINE_PATTERN =
|
4
|
-
|
4
|
+
/^(?<type>[ACDMRTUXB])(?<similarity>[0-9]{3})?[ \t]+(?<name>[^ \t]+)[ \t]*(?<newName>[^ \t]+)?$/;
|
5
5
|
export function parseDiffLines(pString) {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
return pString
|
7
|
+
.split(EOL)
|
8
|
+
.filter(Boolean)
|
9
|
+
.map(parseDiffLine)
|
10
|
+
.filter(({ name, type }) => Boolean(name) && Boolean(type));
|
11
11
|
}
|
12
12
|
export function parseDiffLine(pString) {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
const lMatchResult = pString.match(DIFF_NAME_STATUS_LINE_PATTERN);
|
14
|
+
const lReturnValue = {};
|
15
|
+
if (lMatchResult?.groups) {
|
16
|
+
lReturnValue.type = changeChar2ChangeType(lMatchResult.groups.type);
|
17
|
+
if (lMatchResult.groups.newName) {
|
18
|
+
lReturnValue.name = lMatchResult.groups.newName;
|
19
|
+
lReturnValue.oldName = lMatchResult.groups.name;
|
20
|
+
} else {
|
21
|
+
lReturnValue.name = lMatchResult.groups.name;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
return lReturnValue;
|
25
25
|
}
|
@@ -1,30 +1,30 @@
|
|
1
1
|
import { EOL } from "node:os";
|
2
2
|
import { changeChar2ChangeType } from "./map-change-type.js";
|
3
3
|
const DIFF_SHORT_STATUS_LINE_PATTERN =
|
4
|
-
|
4
|
+
/^(?<stagedType>[ ACDMRTUXB?!])(?<unStagedType>[ ACDMRTUXB?!])[ \t]+(?<name>[^ \t]+)(( -> )(?<newName>[^ \t]+))?$/;
|
5
5
|
export function parseStatusLines(pString) {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
return pString
|
7
|
+
.split(EOL)
|
8
|
+
.filter(Boolean)
|
9
|
+
.map(parseStatusLine)
|
10
|
+
.filter(({ name, type }) => Boolean(name) && Boolean(type));
|
11
11
|
}
|
12
12
|
export function parseStatusLine(pString) {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
13
|
+
const lMatchResult = pString.match(DIFF_SHORT_STATUS_LINE_PATTERN);
|
14
|
+
const lReturnValue = {};
|
15
|
+
if (lMatchResult?.groups) {
|
16
|
+
const lStagedType = changeChar2ChangeType(lMatchResult.groups.stagedType);
|
17
|
+
const lUnStagedType = changeChar2ChangeType(
|
18
|
+
lMatchResult.groups.unStagedType,
|
19
|
+
);
|
20
|
+
lReturnValue.type =
|
21
|
+
lStagedType === "unmodified" ? lUnStagedType : lStagedType;
|
22
|
+
if (lMatchResult.groups.newName) {
|
23
|
+
lReturnValue.name = lMatchResult.groups.newName;
|
24
|
+
lReturnValue.oldName = lMatchResult.groups.name;
|
25
|
+
} else {
|
26
|
+
lReturnValue.name = lMatchResult.groups.name;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
return lReturnValue;
|
30
30
|
}
|
package/dist/version.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const VERSION = "4.0.
|
1
|
+
export const VERSION = "4.0.2";
|
package/package.json
CHANGED
@@ -1,53 +1,53 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
2
|
+
"name": "watskeburt",
|
3
|
+
"version": "4.0.2",
|
4
|
+
"description": "List files changed since a git revision",
|
5
|
+
"keywords": [
|
6
|
+
"git",
|
7
|
+
"diff"
|
8
|
+
],
|
9
|
+
"homepage": "https://github.com/sverweij/watskeburt",
|
10
|
+
"repository": {
|
11
|
+
"type": "git",
|
12
|
+
"url": "git+https://github.com/sverweij/watskeburt.git"
|
13
|
+
},
|
14
|
+
"bugs": {
|
15
|
+
"url": "https://github.com/sverweij/watskeburt/issues"
|
16
|
+
},
|
17
|
+
"author": {
|
18
|
+
"name": "Sander Verweij",
|
19
|
+
"url": "https://sverweij.github.io"
|
20
|
+
},
|
21
|
+
"license": "MIT",
|
22
|
+
"bin": {
|
23
|
+
"watskeburt": "dist/run-cli.js"
|
24
|
+
},
|
25
|
+
"main": "dist/main.js",
|
26
|
+
"module": "dist/main.js",
|
27
|
+
"type": "module",
|
28
|
+
"sideEffects": false,
|
29
|
+
"exports": {
|
30
|
+
".": [
|
31
|
+
{
|
32
|
+
"types": "./types/watskeburt.d.ts",
|
33
|
+
"import": "./dist/main.js"
|
34
|
+
},
|
35
|
+
"./dist/main.js"
|
36
|
+
]
|
37
|
+
},
|
38
|
+
"types": "types/watskeburt.d.ts",
|
39
|
+
"files": [
|
40
|
+
"dist",
|
41
|
+
"!**/*.DS_Store",
|
42
|
+
"types",
|
43
|
+
"LICENSE",
|
44
|
+
"package.json",
|
45
|
+
"README.md"
|
46
|
+
],
|
47
|
+
"engines": {
|
48
|
+
"node": "^18||>=20"
|
49
|
+
},
|
50
|
+
"scripts": {
|
51
|
+
"test": "echo for test, build and static analysis scripts: see the github repository"
|
52
|
+
}
|
53
53
|
}
|
package/types/watskeburt.d.ts
CHANGED
@@ -1,65 +1,65 @@
|
|
1
1
|
export type changeType =
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
2
|
+
| "added"
|
3
|
+
| "copied"
|
4
|
+
| "deleted"
|
5
|
+
| "modified"
|
6
|
+
| "renamed"
|
7
|
+
| "type changed"
|
8
|
+
| "unmerged"
|
9
|
+
| "pairing broken"
|
10
|
+
| "unknown"
|
11
|
+
| "unmodified"
|
12
|
+
| "untracked"
|
13
|
+
| "ignored";
|
14
14
|
|
15
15
|
export interface IChange {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
16
|
+
/**
|
17
|
+
* name of the file
|
18
|
+
*/
|
19
|
+
name: string;
|
20
|
+
/**
|
21
|
+
* how the file was changed
|
22
|
+
*/
|
23
|
+
type: changeType;
|
24
|
+
/**
|
25
|
+
* if the file was renamed: what the old file's name was
|
26
|
+
*/
|
27
|
+
oldName?: string;
|
28
28
|
}
|
29
29
|
|
30
30
|
export type outputTypeType = "regex" | "json";
|
31
31
|
|
32
32
|
export interface IBaseOptions {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
33
|
+
/**
|
34
|
+
* The revision against which to compare. When not passed defaults to the
|
35
|
+
* _current_ commit hash (if there's any)
|
36
|
+
*/
|
37
|
+
oldRevision?: string;
|
38
|
+
/**
|
39
|
+
* Newer revision against which to compare. Leave out when you want to
|
40
|
+
* compare against the working tree
|
41
|
+
*/
|
42
|
+
newRevision?: string;
|
43
|
+
/**
|
44
|
+
* When true only takes already tracked files into account.
|
45
|
+
* When false also takes untracked files into account (default)
|
46
|
+
*/
|
47
|
+
trackedOnly?: boolean;
|
48
48
|
}
|
49
49
|
|
50
50
|
export interface IFormatOptions extends IBaseOptions {
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
/**
|
52
|
+
* The type of output to deliver.
|
53
|
+
*/
|
54
|
+
outputType: "regex" | "json";
|
55
55
|
}
|
56
56
|
|
57
57
|
export interface IInternalOptions extends IBaseOptions {
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
/**
|
59
|
+
* The type of output to deliver. undefined/ left out
|
60
|
+
* the outputType defaults to a list of `IChange`s
|
61
|
+
*/
|
62
|
+
outputType?: undefined;
|
63
63
|
}
|
64
64
|
|
65
65
|
export type IOptions = IFormatOptions | IInternalOptions;
|