Skip to content

Commit

Permalink
Add ignored columns option
Browse files Browse the repository at this point in the history
  • Loading branch information
pymenguy committed Nov 6, 2024
1 parent 13d986c commit 57efef2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/NuGetUtility/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ public class Program
Description = "This option allows to select a Target framework moniker (https://learn.microsoft.com/en-us/dotnet/standard/frameworks) for which to analyze dependencies.")]
public string? TargetFramework { get; } = null;

[Option(LongName = "ignored-columns-from-output",
ShortName = "ignored-columns",
Description = "This option allows to specify column name(s) to exclude from the output")]
public string? IgnoredColumns { get; } = null;

private static string GetVersion()
=> typeof(Program).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? string.Empty;

Expand Down Expand Up @@ -288,5 +293,20 @@ private string[] GetInputFiles()

throw new FileNotFoundException("Please provide an input file");
}

private string[] GetIgnoredColumns()
{
if (IgnoredColumns == null)
{
return Array.Empty<string>();
}

if (File.Exists(IgnoredColumns))
{
return JsonSerializer.Deserialize<string[]>(File.ReadAllText(IgnoredColumns))!;
}

return new[] { IgnoredColumns };
}
}
}

0 comments on commit 57efef2

Please sign in to comment.