Skip to content

Commit

Permalink
Allow target on left (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp authored Aug 7, 2021
1 parent 2560c03 commit 1a9130f
Show file tree
Hide file tree
Showing 46 changed files with 608 additions and 236 deletions.
15 changes: 9 additions & 6 deletions docs/diff-tool.custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ var resolvedTool = DiffTools.AddTool(
isMdi: false,
supportsText: true,
requiresTarget: true,
arguments: (tempFile, targetFile) => $"\"{tempFile}\" \"{targetFile}\"",
targetLeftArguments: (tempFile, targetFile) => $"\"{targetFile}\" \"{tempFile}\"",
targetRightArguments: (tempFile, targetFile) => $"\"{tempFile}\" \"{targetFile}\"",
exePath: diffToolPath,
binaryExtensions: new[] {"jpg"})!;
```
<sup><a href='/src/DiffEngine.Tests/DiffToolsTest.cs#L24-L34' title='Snippet source file'>snippet source</a> | <a href='#snippet-addtool' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/DiffEngine.Tests/DiffToolsTest.cs#L24-L35' title='Snippet source file'>snippet source</a> | <a href='#snippet-addtool' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Add a tool based on existing resolved tool:
Expand All @@ -33,9 +34,10 @@ Add a tool based on existing resolved tool:
var resolvedTool = DiffTools.AddToolBasedOn(
DiffTool.VisualStudio,
name: "MyCustomDiffTool",
arguments: (temp, target) => $"\"custom args {temp}\" \"{target}\"");
targetLeftArguments: (temp, target) => $"\"custom args \"{target}\" \"{temp}\"",
targetRightArguments: (temp, target) => $"\"custom args \"{temp}\" \"{target}\"");
```
<sup><a href='/src/DiffEngine.Tests/DiffToolsTest.cs#L63-L68' title='Snippet source file'>snippet source</a> | <a href='#snippet-addtoolbasedon' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/DiffEngine.Tests/DiffToolsTest.cs#L65-L73' title='Snippet source file'>snippet source</a> | <a href='#snippet-addtoolbasedon' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand All @@ -59,11 +61,12 @@ Alternatively the instance returned from `AddTool*` can be used to explicitly l
var resolvedTool = DiffTools.AddToolBasedOn(
DiffTool.VisualStudio,
name: "MyCustomDiffTool",
arguments: (temp, target) => $"\"custom args {temp}\" \"{target}\"");
targetLeftArguments: (temp, target) => $"\"custom args {target}\" \"{temp}\"",
targetRightArguments: (temp, target) => $"\"custom args {temp}\" \"{target}\"");

await DiffRunner.LaunchAsync(resolvedTool!, "PathToTempFile", "PathToTargetFile");
```
<sup><a href='/src/DiffEngine.Tests/DiffToolsTest.cs#L77-L84' title='Snippet source file'>snippet source</a> | <a href='#snippet-addtoolandlaunch' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/DiffEngine.Tests/DiffToolsTest.cs#L84-L92' title='Snippet source file'>snippet source</a> | <a href='#snippet-addtoolandlaunch' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
Loading

0 comments on commit 1a9130f

Please sign in to comment.