Files
esiur-dotnet/Tools/Esiur.CLI/Rendering/OutputFormat.cs
T
2026-07-18 00:44:14 +03:00

18 lines
559 B
C#

namespace Esiur.CLI;
public enum OutputFormat { Table, Json, JsonLines, Raw }
public static class OutputFormatExtensions
{
public static OutputFormat Parse(string? value) => value?.ToLowerInvariant() switch
{
"table" or null => OutputFormat.Table,
"json" => OutputFormat.Json,
"jsonl" => OutputFormat.JsonLines,
"raw" => OutputFormat.Raw,
_ => throw new CliException(
$"Output format \"{value}\" is invalid. Expected table, json, jsonl, or raw.",
ExitCodes.InvalidArguments),
};
}