Skip to content

Commit 9be6b0f

Browse files
MichaelPetrinolishishamco
authored andcommitted
Enhance template option and simplify path logic
The `-t|--template` option now supports a new value, `TemplateEngine.Both`, and sets it as the default value. This improves flexibility by allowing an additional template engine.
1 parent 50406fa commit 9be6b0f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/OrchardCoreContrib.PoExtractor/Program.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ public static void Main(string[] args)
3030
option.DefaultValue = "C#";
3131
});
3232
var template = app.Option("-t|--template <TEMPLATE>", "Specifies the template engine to extract the translatable strings from.", CommandOptionType.SingleValue, option =>
33-
option.Accepts(cfg => cfg.Values("Razor", "Liquid"))
34-
);
33+
{
34+
option.Accepts(cfg => cfg.Values(TemplateEngine.Both, "Razor", "Liquid"));
35+
option.DefaultValue = TemplateEngine.Both;
36+
});
3537
var ignoredProjects = app.Option("-i|--ignore <IGNORED_PROJECTS>", "Ignores extracting PO files from a given project(s).", CommandOptionType.MultipleValue);
3638
var localizers = app.Option("--localizer <LOCALIZERS>", "Specifies the name of the localizer(s) that will be used during the extraction process.", CommandOptionType.MultipleValue);
3739
var single = app.Option("-s|--single <FILE_NAME>", "Specifies the single output file.", CommandOptionType.SingleValue);
@@ -112,7 +114,7 @@ public static void Main(string[] args)
112114
var projectBasePath = Path.GetDirectoryName(projectPath) + Path.DirectorySeparatorChar;
113115
var projectRelativePath = projectPath[projectBasePath.Length..];
114116
var rootedProject = projectPath == inputPath.Value
115-
? projectPath
117+
? projectPath
116118
: projectPath[(projectPath.IndexOf(inputPath.Value, StringComparison.Ordinal) + inputPath.Value.Length + 1)..];
117119
if (IgnoredProject.ToList().Any(p => rootedProject.StartsWith(p)))
118120
{

0 commit comments

Comments
 (0)