MCPcopy Index your code
hub / github.com/danvk/webdiff / gitDiffOptionsToFlags

Function gitDiffOptionsToFlags

ts/diff-options.ts:21–45  ·  view source on GitHub ↗
(opts: Partial<GitDiffOptions>)

Source from the content-addressed store, hash-verified

19}
20
21export function gitDiffOptionsToFlags(opts: Partial<GitDiffOptions>) {
22 const flags = [];
23 if (opts.ignoreAllSpace) {
24 flags.push('-w');
25 }
26 if (opts.ignoreSpaceChange) {
27 flags.push('-b');
28 }
29 if (opts.diffAlgorithm) {
30 flags.push(`--diff-algorithm=${opts.diffAlgorithm}`);
31 }
32 if (opts.unified) {
33 flags.push(`-U${opts.unified}`);
34 }
35 if (opts.findRenames) {
36 flags.push(`--find-renames=${opts.findRenames}%`);
37 }
38 if (opts.findCopies) {
39 flags.push(`--find-copies=${opts.findCopies}%`);
40 }
41 if (opts.functionContext) {
42 flags.push('-W');
43 }
44 return flags;
45}
46
47export function flagsToGitDiffOptions(flags: string[]): Partial<GitDiffOptions> {
48 const options: Partial<GitDiffOptions> = {};

Callers 4

getDiffFunction · 0.90
DiffOptionsControlFunction · 0.90
encodeOptionsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected