Skip to content

Commit 02049cf

Browse files
committed
Add a new option to set a prefix for generated files in CLI.
1 parent 62c030a commit 02049cf

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

src/CLI/CLI.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ static bool ParseCommandLineArgs(string[] args, List<string> errorMessages, ref
3232
optionSet.Add("g=|gen=|generator=", "the {TYPE} of generated code: 'csharp' or 'cli' ('cli' supported only for Windows)", g => { GetGeneratorKind(g, errorMessages); } );
3333
optionSet.Add("p=|platform=", "the {PLATFORM} that the generated code will target: 'win', 'osx' or 'linux'", p => { GetDestinationPlatform(p, errorMessages); } );
3434
optionSet.Add("a=|arch=", "the {ARCHITECTURE} that the generated code will target: 'x86' or 'x64'", a => { GetDestinationArchitecture(a, errorMessages); } );
35+
optionSet.Add("prefix=", "sets a string prefix to the names of generated files", a => { options.Prefix = a; });
3536

3637
optionSet.Add("exceptions", "enables support for C++ exceptions in the parser", v => { options.EnableExceptions = true; });
3738
optionSet.Add("rtti", "enables support for C++ RTTI in the parser", v => { options.EnableRTTI = true; });

src/CLI/Generator.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ public void Setup(Driver driver)
187187
driverOptions.OutputDir = options.OutputDir;
188188
driverOptions.CheckSymbols = options.CheckSymbols;
189189
driverOptions.Verbose = options.Verbose;
190+
191+
if (!string.IsNullOrEmpty(options.Prefix))
192+
driverOptions.GenerateName = name =>
193+
options.Prefix + name.FileNameWithoutExtension;
190194
}
191195

192196
private void SetupLinuxOptions(ParserOptions parserOptions)

src/CLI/Options.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class Options
3030
public string OutputFileName { get; set; }
3131

3232
public string InputLibraryName { get; set; }
33+
34+
public string Prefix { get; set; }
3335

3436
public TargetPlatform? Platform { get; set; }
3537

0 commit comments

Comments
 (0)