mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-07-31 01:40:42 +00:00
Esiur CLI
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
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),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user