This repository has been archived by the owner on Oct 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Extra.cs
55 lines (50 loc) · 1.91 KB
/
Extra.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using CommandLine;
using CommandLine.Text;
using FlagPFP.Loading;
using Pastel;
using System;
using System.Drawing;
using System.Linq;
namespace FlagPFP.Main
{
public partial class MainProgram
{
public static void LogError(string error, bool exit = false)
{
Console.WriteLine("Error: ".Pastel(Color.IndianRed) +
error.Pastel(Color.Red));
if (exit) Environment.Exit(1);
}
public static void DisplayHelp<T>(ParserResult<T> result)
{
HelpText helpText = null;
helpText = HelpText.AutoBuild(result, h =>
{
h.AdditionalNewLineAfterOption = true;
h.Heading = "FlagPFP".Pastel(Color.PaleTurquoise) + " v2.0".Pastel(Color.PaleGreen);
h.Copyright = "Copyleft AestheticalZ 2021".Pastel(Color.Aquamarine);
return HelpText.DefaultParsingErrorsHandler(result, h);
}, e => e);
Console.WriteLine(helpText);
}
public static void WriteHeaders(PrideFlag flag, bool writeCredits = true, bool helpMode = false)
{
if (helpMode)
{
Console.Write($"-{flag.ConsoleHeader}- ".Pastel(Color.LightSteelBlue)
+ string.Join("", flag.FlagPattern.Select(s => " ".PastelBg(s))));
Console.WriteLine($" {flag.ParameterName}\n".Pastel(Color.DarkCyan));
}
else
{
Console.WriteLine($"-{flag.ConsoleHeader}- ".Pastel(Color.LightSteelBlue)
+ string.Join("", flag.FlagPattern.Select(s => " ".PastelBg(s))));
Console.WriteLine();
}
if (!string.IsNullOrEmpty(flag.DesignCredits) && writeCredits == true)
{
Console.WriteLine(flag.DesignCredits.Pastel(Color.PowderBlue));
}
}
}
}