Map renderer file name option (#12463)
* Add option for supplying map names instead of ids as argument * Allow options to be used with the map selector
This commit is contained in:
@@ -10,8 +10,8 @@ public sealed class CommandLineArguments
|
||||
public List<string> Maps { get; set; } = new();
|
||||
public OutputFormat Format { get; set; } = OutputFormat.png;
|
||||
public bool ExportViewerJson { get; set; } = false;
|
||||
|
||||
public string OutputPath { get; set; } = DirectoryExtensions.MapImages().FullName;
|
||||
public bool ArgumentsAreFileNames { get; set; } = false;
|
||||
|
||||
public static bool TryParse(IReadOnlyList<string> args, [NotNullWhen(true)] out CommandLineArguments? parsed)
|
||||
{
|
||||
@@ -20,7 +20,8 @@ public sealed class CommandLineArguments
|
||||
if (args.Count == 0)
|
||||
{
|
||||
PrintHelp();
|
||||
return false;
|
||||
//Returns true here so the user can select what maps they want to render
|
||||
return true;
|
||||
}
|
||||
|
||||
using var enumerator = args.GetEnumerator();
|
||||
@@ -53,6 +54,11 @@ public sealed class CommandLineArguments
|
||||
parsed.OutputPath = enumerator.Current;
|
||||
break;
|
||||
|
||||
case "-f":
|
||||
case "--files":
|
||||
parsed.ArgumentsAreFileNames = true;
|
||||
break;
|
||||
|
||||
case "-h":
|
||||
case "--help":
|
||||
PrintHelp();
|
||||
@@ -64,6 +70,13 @@ public sealed class CommandLineArguments
|
||||
}
|
||||
}
|
||||
|
||||
if (parsed.ArgumentsAreFileNames && parsed.Maps.Count == 0)
|
||||
{
|
||||
Console.WriteLine("No file names specified!");
|
||||
PrintHelp();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -80,6 +93,9 @@ Options:
|
||||
-o / --output <output path>
|
||||
Changes the path the rendered maps will get saved to.
|
||||
Defaults to Resources/MapImages
|
||||
-f / --files
|
||||
This option tells the map renderer that you supplied a list of map file names instead of their ids.
|
||||
Example: Content.MapRenderer -f box.yml bagel.yml
|
||||
-h / --help
|
||||
Displays this help text");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user