Skip to content

Instantly share code, notes, and snippets.

@CristianoRC
Last active January 13, 2019 03:14
Show Gist options
  • Save CristianoRC/29ac3d43507a448db3172034a8aa2dfa to your computer and use it in GitHub Desktop.
Save CristianoRC/29ac3d43507a448db3172034a8aa2dfa to your computer and use it in GitHub Desktop.
using System;
using CommandLine;
namespace parametros
{
class Program
{
static void Main(string[] args)
{
Parser.Default.ParseArguments<Options>(args)
.WithParsed(options =>
{
Console.Title = options.Title;
if (options.Verbose)
{
if (!string.IsNullOrEmpty(options.Color))
{
Enum.TryParse(options.Color, true, out ConsoleColor consoleColor);
Console.ForegroundColor = consoleColor;
}
Console.Clear();
Console.WriteLine($"Título informado: {options.Title}\n");
Console.WriteLine($"Nome completo: {options.Name}");
Console.ReadKey();
}
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment