This commit is contained in:
2024-01-01 15:15:11 +06:00
parent 7fe79f0300
commit 0c2670f55a
8 changed files with 38 additions and 35 deletions

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Text;
using DiffMatchPatch;
using DTLib.Ben.Demystifier;
using DTLib.Console;
using DTLib.Filesystem;
@@ -26,17 +25,17 @@ public static class DiffText
List<Diff>? diff = null;
bool noColors = false;
new LaunchArgumentParser(
new LaunchArgument(new[] { "s", "string" },
new LaunchArgument(["s", "string"],
"shows difference of two strings",
(s0, s1) => diff=TextDiff(s0, s1),
"string0", "string1",
1),
new LaunchArgument(new[] { "f", "file" },
new LaunchArgument(["f", "file"],
"shows difference of two text files",
(f0,f1) => diff=FileDiff(f0, f1),
"file0", "file1",
1),
new LaunchArgument(new []{"p", "plain-text","no-colors"},
new LaunchArgument(["p", "plain-text","no-colors"],
"print diff in plain text format",
()=> noColors=true,
0)
@@ -49,7 +48,7 @@ public static class DiffText
{ }
catch (Exception ex)
{
ColoredConsole.WriteLine("r", ex.ToStringDemystified());
ColoredConsole.WriteLine("r", $"{ex.Message} at {ex.Source}");
return 1;
}

View File

@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>diff_text</RootNamespace>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>12</LangVersion>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>diff_text</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DTLib.Ben.Demystifier" Version="1.0.4" />
<PackageReference Include="google-diff-match-patch" Version="1.3.74" />
<PackageReference Include="google-diff-match-patch" Version="1.3.98" />
<PackageReference Include="DTLib" Version="1.3.0" />
</ItemGroup>
</Project>