Skip to content

Commit

Permalink
Add ignore projects option
Browse files Browse the repository at this point in the history
  • Loading branch information
hishamco committed May 2, 2024
1 parent a41a9bc commit 9621f71
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/OrchardCoreContrib.PoExtractor/IgnoredProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ public class IgnoredProject

public static readonly string Test = "test";

public static IEnumerable<string> ToList()
{
yield return Docs;
yield return Cms;
yield return Mvc;
yield return Templates;
yield return Test;
}
private static readonly List<string> _ignoredProjects = [ Docs, Cms, Mvc, Templates ];

public static void Add(string project) => _ignoredProjects.Add(project);

public static IEnumerable<string> ToList() => _ignoredProjects;
}
14 changes: 14 additions & 0 deletions src/OrchardCoreContrib.PoExtractor/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,19 @@ private static (string language, string templateEngine) GetCliOptions(string[] a
templateEngine = null;
}

break;
case "-i":
case "--ignore":
if (!string.IsNullOrEmpty(args[i - 1]))
{
var ignoredProjects = args[i - 1].Split(',', StringSplitOptions.RemoveEmptyEntries);

foreach (var ignoredProject in ignoredProjects)
{
IgnoredProject.Add(ignoredProject);
}
}

break;
default:
language = null;
Expand All @@ -172,5 +185,6 @@ private static void ShowHelp()
Console.WriteLine(" Default: C# language");
Console.WriteLine(" -t, --template <Razor|Liquid> Specifies the template engine to extract the translatable strings from.");
Console.WriteLine(" Default: Razor & Liquid templates");
Console.WriteLine(" -i, --ignore project1,project2, Ignores extracting PO filed from a given project(s).");
}
}

0 comments on commit 9621f71

Please sign in to comment.