Docs redesign (#728)

* Adding a dark mode
* Adding reference for types to summary pages
* Adding API Reference
* Adding modifiers to methods/fields/etc
* Minimizing files input
* Caching a lot of the output pages
* Cache only for each execution
* Adding API references to existing docs
This commit is contained in:
Phil Scott
2022-02-14 12:44:25 -05:00
committed by GitHub
parent 74a2e10ff0
commit c2da268129
147 changed files with 4112 additions and 6897 deletions

View File

@ -1,7 +1,7 @@
using System.ComponentModel;
using Spectre.Console.Cli;
namespace Spectre.Console.Examples;
namespace Delegates;
public static partial class Program
{

View File

@ -1,6 +1,7 @@
using Spectre.Console;
using Spectre.Console.Cli;
namespace Spectre.Console.Examples;
namespace Delegates;
public static partial class Program
{

View File

@ -2,7 +2,7 @@ using System.ComponentModel;
using Demo.Utilities;
using Spectre.Console.Cli;
namespace Demo.Commands;
namespace Demo.Commands.Add;
[Description("Add a NuGet package reference to the project.")]
public sealed class AddPackageCommand : Command<AddPackageCommand.Settings>

View File

@ -2,7 +2,7 @@ using System.ComponentModel;
using Demo.Utilities;
using Spectre.Console.Cli;
namespace Demo.Commands;
namespace Demo.Commands.Add;
public sealed class AddReferenceCommand : Command<AddReferenceCommand.Settings>
{

View File

@ -1,7 +1,7 @@
using System.ComponentModel;
using Spectre.Console.Cli;
namespace Demo.Commands;
namespace Demo.Commands.Add;
public abstract class AddSettings : CommandSettings
{

View File

@ -2,7 +2,7 @@ using System.ComponentModel;
using Demo.Utilities;
using Spectre.Console.Cli;
namespace Demo.Commands;
namespace Demo.Commands.Run;
[Description("Build and run a .NET project output.")]
public sealed class RunCommand : Command<RunCommand.Settings>

View File

@ -3,7 +3,7 @@ using System.ComponentModel;
using Demo.Utilities;
using Spectre.Console.Cli;
namespace Demo.Commands;
namespace Demo.Commands.Serve;
[Description("Launches a web server in the current working directory and serves all files in it.")]
public sealed class ServeCommand : Command<ServeCommand.Settings>

View File

@ -1,4 +1,7 @@
using Demo.Commands;
using Demo.Commands.Add;
using Demo.Commands.Run;
using Demo.Commands.Serve;
using Spectre.Console.Cli;
namespace Demo;

View File

@ -1,7 +1,8 @@
using System;
using Spectre.Console;
using Spectre.Console.Cli;
namespace Spectre.Console.Examples;
namespace Dynamic;
public sealed class MyCommand : Command
{

View File

@ -1,7 +1,7 @@
using System.Linq;
using Spectre.Console.Cli;
namespace Spectre.Console.Examples;
namespace Dynamic;
public static class Program
{

View File

@ -2,7 +2,7 @@ using System;
using System.ComponentModel;
using Spectre.Console.Cli;
namespace Spectre.Console.Examples;
namespace Injection.Commands;
public sealed class DefaultCommand : Command<DefaultCommand.Settings>
{

View File

@ -1,4 +1,6 @@
namespace Spectre.Console.Examples;
using Spectre.Console;
namespace Injection;
public interface IGreeter
{

View File

@ -2,7 +2,7 @@ using System;
using Microsoft.Extensions.DependencyInjection;
using Spectre.Console.Cli;
namespace Spectre.Console.Examples;
namespace Injection.Infrastructure;
public sealed class TypeRegistrar : ITypeRegistrar
{

View File

@ -1,8 +1,7 @@
using System;
using Microsoft.Extensions.DependencyInjection;
using Spectre.Console.Cli;
namespace Spectre.Console.Examples;
namespace Injection.Infrastructure;
public sealed class TypeResolver : ITypeResolver, IDisposable
{

View File

@ -1,7 +1,9 @@
using Injection.Commands;
using Injection.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Spectre.Console.Cli;
namespace Spectre.Console.Examples;
namespace Injection;
public class Program
{

View File

@ -1,7 +1,8 @@
using Microsoft.Extensions.Logging;
using Spectre.Console;
using Spectre.Console.Cli;
namespace Spectre.Console.Examples;
namespace Logging.Commands;
public class HelloCommand : Command<HelloCommand.Settings>
{

View File

@ -5,7 +5,7 @@ using System.Globalization;
using Serilog.Events;
using Spectre.Console.Cli;
namespace Spectre.Console.Examples;
namespace Logging.Commands;
public class LogCommandSettings : CommandSettings
{

View File

@ -1,7 +1,8 @@
using Logging.Commands;
using Serilog.Core;
using Spectre.Console.Cli;
namespace Spectre.Console.Examples;
namespace Logging.Infrastructure;
public class LogInterceptor : ICommandInterceptor
{

View File

@ -1,7 +1,7 @@
using Serilog.Core;
using Serilog.Events;
namespace Spectre.Console.Examples;
namespace Logging.Infrastructure;
internal class LoggingEnricher : ILogEventEnricher
{

View File

@ -2,7 +2,7 @@ using System;
using Microsoft.Extensions.DependencyInjection;
using Spectre.Console.Cli;
namespace Spectre.Console.Examples;
namespace Logging.Infrastructure;
public sealed class TypeRegistrar : ITypeRegistrar
{

View File

@ -1,8 +1,7 @@
using System;
using Microsoft.Extensions.DependencyInjection;
using Spectre.Console.Cli;
namespace Spectre.Console.Examples;
namespace Logging.Infrastructure;
public sealed class TypeResolver : ITypeResolver
{

View File

@ -1,3 +1,5 @@
using Logging.Commands;
using Logging.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using Serilog;
using Spectre.Console.Cli;
@ -12,7 +14,7 @@ using Spectre.Console.Cli;
* Spectre.Console CommandInterceptor
*/
namespace Spectre.Console.Examples;
namespace Logging;
public class Program
{

View File

@ -1,6 +1,7 @@
using Spectre.Console;
using Spectre.Console.Rendering;
namespace Spectre.Console.Examples;
namespace Borders;
public static class Program
{

View File

@ -1,4 +1,6 @@
namespace Spectre.Console.Examples;
using Spectre.Console;
namespace Calendars;
public static class Program
{

View File

@ -4,8 +4,9 @@ Licensed under GNU Free Documentation License 1.2
*/
using System;
using Spectre.Console;
namespace Spectre.Console.Examples;
namespace Canvas;
public static class Mandelbrot
{
@ -39,9 +40,9 @@ public static class Mandelbrot
}
}
public static Canvas Generate(int width, int height)
public static Spectre.Console.Canvas Generate(int width, int height)
{
var canvas = new Canvas(width, height);
var canvas = new Spectre.Console.Canvas(width, height);
var scale = 2 * MaxValueExtent / Math.Min(canvas.Width, canvas.Height);
for (var i = 0; i < canvas.Height; i++)

View File

@ -1,9 +1,10 @@
using System.Diagnostics;
using System.Reflection;
using SixLabors.ImageSharp.Processing;
using Spectre.Console;
using Spectre.Console.Rendering;
namespace Spectre.Console.Examples;
namespace Canvas;
public static class Program
{

View File

@ -1,6 +1,7 @@
using Spectre.Console;
using Spectre.Console.Rendering;
namespace Spectre.Console.Examples;
namespace Charts;
public static class Program
{

View File

@ -1,4 +1,7 @@
namespace Spectre.Console.Examples;
using Spectre.Console;
using Spectre.Console.Examples;
namespace Colors;
public static class Program
{

View File

@ -1,6 +1,7 @@
using System.Collections.Generic;
using Spectre.Console;
namespace Spectre.Console.Examples;
namespace Columns;
public static class Program
{
@ -16,7 +17,7 @@ public static class Program
}
// Render all cards in columns
AnsiConsole.Write(new Columns(cards));
AnsiConsole.Write(new Spectre.Console.Columns(cards));
}
private static string GetCardContent(User user)

View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace Spectre.Console.Examples;
namespace Columns;
public sealed class User
{

View File

@ -1,4 +1,6 @@
namespace Spectre.Console.Examples;
using Spectre.Console;
namespace Cursor;
public static class Program
{

View File

@ -1,4 +1,6 @@
namespace Spectre.Console.Examples;
using Spectre.Console;
namespace Emojis;
public static class Program
{

View File

@ -3,8 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Security.Authentication;
using System.Threading.Tasks;
using Spectre.Console;
namespace Spectre.Console.Examples;
namespace Exceptions;
public static class Program
{

View File

@ -1,4 +1,6 @@
namespace Spectre.Console.Examples;
using Spectre.Console;
namespace Figlet;
public static class Program
{

View File

@ -1,4 +1,6 @@
namespace Spectre.Console.Examples;
using Spectre.Console;
namespace Grids;
public static class Program
{

View File

@ -1,4 +1,6 @@
namespace Spectre.Console.Examples;
using Spectre.Console;
namespace Info;
public static class Program
{

View File

@ -1,4 +1,6 @@
namespace Spectre.Console.Examples;
using Spectre.Console;
namespace Links;
public static class Program
{

View File

@ -1,7 +1,8 @@
using System;
using System.Threading;
using Spectre.Console;
namespace Spectre.Console.Examples;
namespace Live;
public static class Program
{

View File

@ -1,8 +1,9 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Spectre.Console;
namespace Spectre.Console.Examples;
namespace LiveTable;
public static class Program
{

View File

@ -1,4 +1,6 @@
namespace Spectre.Console.Examples;
using Spectre.Console;
namespace Panels;
public static class Program
{

View File

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace Spectre.Console.Examples;
namespace Progress;
public static class DescriptionGenerator
{

View File

@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using System.Threading;
using Spectre.Console;
namespace Spectre.Console.Examples;
namespace Progress;
public static class Program
{

View File

@ -1,4 +1,6 @@
namespace Spectre.Console.Examples
using Spectre.Console;
namespace Prompt
{
public static class Program
{
@ -12,18 +14,28 @@ namespace Spectre.Console.Examples
}
// Confirmation
if (!AnsiConsole.Confirm("Run prompt example?"))
if (!AskConfirmation())
{
AnsiConsole.MarkupLine("Ok... :(");
return;
}
// Ask the user for some different things
WriteDivider("Strings");
var name = AskName();
WriteDivider("Lists");
var fruit = AskFruit();
WriteDivider("Choices");
var sport = AskSport();
WriteDivider("Integers");
var age = AskAge();
WriteDivider("Secrets");
var password = AskPassword();
WriteDivider("Optional");
var color = AskColor();
// Summary
@ -40,19 +52,31 @@ namespace Spectre.Console.Examples
.AddRow("[grey]Favorite color[/]", string.IsNullOrEmpty(color) ? "Unknown" : color));
}
private static string AskName()
private static void WriteDivider(string text)
{
AnsiConsole.WriteLine();
AnsiConsole.Write(new Rule("[yellow]Strings[/]").RuleStyle("grey").LeftAligned());
AnsiConsole.Write(new Rule($"[yellow]{text}[/]").RuleStyle("grey").LeftAligned());
}
public static bool AskConfirmation()
{
if (!AnsiConsole.Confirm("Run prompt example?"))
{
AnsiConsole.MarkupLine("Ok... :(");
return false;
}
return true;
}
public static string AskName()
{
var name = AnsiConsole.Ask<string>("What's your [green]name[/]?");
return name;
}
private static string AskFruit()
public static string AskFruit()
{
AnsiConsole.WriteLine();
AnsiConsole.Write(new Rule("[yellow]Lists[/]").RuleStyle("grey").LeftAligned());
var favorites = AnsiConsole.Prompt(
new MultiSelectionPrompt<string>()
.PageSize(10)
@ -87,11 +111,8 @@ namespace Spectre.Console.Examples
return fruit;
}
private static string AskSport()
public static string AskSport()
{
AnsiConsole.WriteLine();
AnsiConsole.Write(new Rule("[yellow]Choices[/]").RuleStyle("grey").LeftAligned());
return AnsiConsole.Prompt(
new TextPrompt<string>("What's your [green]favorite sport[/]?")
.InvalidChoiceMessage("[red]That's not a sport![/]")
@ -101,11 +122,8 @@ namespace Spectre.Console.Examples
.AddChoice("Basketball"));
}
private static int AskAge()
public static int AskAge()
{
AnsiConsole.WriteLine();
AnsiConsole.Write(new Rule("[yellow]Integers[/]").RuleStyle("grey").LeftAligned());
return AnsiConsole.Prompt(
new TextPrompt<int>("How [green]old[/] are you?")
.PromptStyle("green")
@ -121,22 +139,16 @@ namespace Spectre.Console.Examples
}));
}
private static string AskPassword()
public static string AskPassword()
{
AnsiConsole.WriteLine();
AnsiConsole.Write(new Rule("[yellow]Secrets[/]").RuleStyle("grey").LeftAligned());
return AnsiConsole.Prompt(
new TextPrompt<string>("Enter [green]password[/]?")
.PromptStyle("red")
.Secret());
}
private static string AskColor()
public static string AskColor()
{
AnsiConsole.WriteLine();
AnsiConsole.Write(new Rule("[yellow]Optional[/]").RuleStyle("grey").LeftAligned());
return AnsiConsole.Prompt(
new TextPrompt<string>("[grey][[Optional]][/] What is your [green]favorite color[/]?")
.AllowEmpty());

View File

@ -1,4 +1,6 @@
namespace Spectre.Console.Examples;
using Spectre.Console;
namespace Rules;
public static class Program
{

View File

@ -1,6 +1,6 @@
using System;
namespace Spectre.Console.Examples;
namespace Showcase;
public static class ExceptionGenerator
{

View File

@ -1,6 +1,8 @@
using Spectre.Console;
using Spectre.Console.Examples;
using Spectre.Console.Rendering;
namespace Spectre.Console.Examples;
namespace Showcase;
public static partial class Program
{

View File

@ -1,6 +1,7 @@
using System.Threading;
using Spectre.Console;
namespace Spectre.Console.Examples;
namespace Status;
public static class Program
{

View File

@ -1,4 +1,6 @@
namespace Spectre.Console.Examples;
using Spectre.Console;
namespace Tables;
public static class Program
{

View File

@ -1,4 +1,6 @@
namespace Spectre.Console.Examples;
using Spectre.Console;
namespace Trees;
public static class Program
{

View File

@ -69,6 +69,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Minimal", "Console\Minimal\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AlternateScreen", "Console\AlternateScreen\AlternateScreen.csproj", "{8A3B636E-5828-438B-A8F4-83811D2704CD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spectre.Console", "..\src\Spectre.Console\Spectre.Console.csproj", "{0C58FB17-F60A-47AB-84BF-961EC8C06AE6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spectre.Console.ImageSharp", "..\src\Spectre.Console.ImageSharp\Spectre.Console.ImageSharp.csproj", "{A127CE7D-A5A7-4745-9809-EBD7CB12CEE7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -451,6 +455,30 @@ Global
{8A3B636E-5828-438B-A8F4-83811D2704CD}.Release|x64.Build.0 = Release|Any CPU
{8A3B636E-5828-438B-A8F4-83811D2704CD}.Release|x86.ActiveCfg = Release|Any CPU
{8A3B636E-5828-438B-A8F4-83811D2704CD}.Release|x86.Build.0 = Release|Any CPU
{0C58FB17-F60A-47AB-84BF-961EC8C06AE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C58FB17-F60A-47AB-84BF-961EC8C06AE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C58FB17-F60A-47AB-84BF-961EC8C06AE6}.Debug|x64.ActiveCfg = Debug|Any CPU
{0C58FB17-F60A-47AB-84BF-961EC8C06AE6}.Debug|x64.Build.0 = Debug|Any CPU
{0C58FB17-F60A-47AB-84BF-961EC8C06AE6}.Debug|x86.ActiveCfg = Debug|Any CPU
{0C58FB17-F60A-47AB-84BF-961EC8C06AE6}.Debug|x86.Build.0 = Debug|Any CPU
{0C58FB17-F60A-47AB-84BF-961EC8C06AE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C58FB17-F60A-47AB-84BF-961EC8C06AE6}.Release|Any CPU.Build.0 = Release|Any CPU
{0C58FB17-F60A-47AB-84BF-961EC8C06AE6}.Release|x64.ActiveCfg = Release|Any CPU
{0C58FB17-F60A-47AB-84BF-961EC8C06AE6}.Release|x64.Build.0 = Release|Any CPU
{0C58FB17-F60A-47AB-84BF-961EC8C06AE6}.Release|x86.ActiveCfg = Release|Any CPU
{0C58FB17-F60A-47AB-84BF-961EC8C06AE6}.Release|x86.Build.0 = Release|Any CPU
{A127CE7D-A5A7-4745-9809-EBD7CB12CEE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A127CE7D-A5A7-4745-9809-EBD7CB12CEE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A127CE7D-A5A7-4745-9809-EBD7CB12CEE7}.Debug|x64.ActiveCfg = Debug|Any CPU
{A127CE7D-A5A7-4745-9809-EBD7CB12CEE7}.Debug|x64.Build.0 = Debug|Any CPU
{A127CE7D-A5A7-4745-9809-EBD7CB12CEE7}.Debug|x86.ActiveCfg = Debug|Any CPU
{A127CE7D-A5A7-4745-9809-EBD7CB12CEE7}.Debug|x86.Build.0 = Debug|Any CPU
{A127CE7D-A5A7-4745-9809-EBD7CB12CEE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A127CE7D-A5A7-4745-9809-EBD7CB12CEE7}.Release|Any CPU.Build.0 = Release|Any CPU
{A127CE7D-A5A7-4745-9809-EBD7CB12CEE7}.Release|x64.ActiveCfg = Release|Any CPU
{A127CE7D-A5A7-4745-9809-EBD7CB12CEE7}.Release|x64.Build.0 = Release|Any CPU
{A127CE7D-A5A7-4745-9809-EBD7CB12CEE7}.Release|x86.ActiveCfg = Release|Any CPU
{A127CE7D-A5A7-4745-9809-EBD7CB12CEE7}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -462,6 +490,8 @@ Global
{DEB88B47-658E-4FCB-BD1D-05C99E7EFA58} = {4682E9B7-B54C-419D-B92F-470DA4E5674C}
{37024E79-A857-4EB2-9B50-F724ED34E5EB} = {4682E9B7-B54C-419D-B92F-470DA4E5674C}
{DD8EC1B0-F50C-44E4-8399-2D560F95E572} = {2571F1BD-6556-4F96-B27B-B6190E1BF13A}
{0C58FB17-F60A-47AB-84BF-961EC8C06AE6} = {2571F1BD-6556-4F96-B27B-B6190E1BF13A}
{A127CE7D-A5A7-4745-9809-EBD7CB12CEE7} = {2571F1BD-6556-4F96-B27B-B6190E1BF13A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3EE724C5-CAB4-410D-AC63-8D4260EF83ED}