mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-10-25 15:19:23 +00:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01fdbac51e | ||
|
|
b0b988a1e7 | ||
|
|
2a9fa223de | ||
|
|
4f6eca4fcb | ||
|
|
a5125d640c | ||
|
|
a59e0dcb21 | ||
|
|
bde61cc6ff | ||
|
|
5c33b87a9c | ||
|
|
aaf77c3b25 | ||
|
|
d70ad661fc | ||
|
|
0d209d8f18 | ||
|
|
380c6aca45 | ||
|
|
b1da5e7ba8 | ||
|
|
be3350a411 | ||
|
|
a1d11e9d0c | ||
|
|
93d1971f48 | ||
|
|
bca1c889d1 | ||
|
|
9915a0d6a8 | ||
|
|
f34fc43d00 | ||
|
|
e7f497050c | ||
|
|
3e5e22d6c2 | ||
|
|
10daf727e9 |
21
.github/workflows/ci.yaml
vendored
21
.github/workflows/ci.yaml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: '3.1.301' # SDK Version to use.
|
||||
dotnet-version: 5.0.100
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
@@ -55,10 +55,15 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup dotnet
|
||||
- name: Setup dotnet 3.1.402
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 3.1.301
|
||||
dotnet-version: 3.1.402
|
||||
|
||||
- name: Setup dotnet 5.0.100
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 5.0.100
|
||||
|
||||
- name: Integration Tests
|
||||
shell: bash
|
||||
@@ -77,4 +82,12 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
dotnet tool restore
|
||||
dotnet cake
|
||||
dotnet cake
|
||||
|
||||
- name: Upload Verify Test Results
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: verify-test-results
|
||||
path: |
|
||||
**/*.received.*
|
||||
2
.github/workflows/docs.yaml
vendored
2
.github/workflows/docs.yaml
vendored
@@ -24,7 +24,7 @@ jobs:
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: '3.1.301' # SDK Version to use.
|
||||
dotnet-version: 5.0.100
|
||||
|
||||
- name: Publish
|
||||
shell: bash
|
||||
|
||||
20
.github/workflows/publish.yaml
vendored
20
.github/workflows/publish.yaml
vendored
@@ -29,7 +29,7 @@ jobs:
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: '3.1.301' # SDK Version to use.
|
||||
dotnet-version: 5.0.100
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
@@ -64,10 +64,15 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup dotnet
|
||||
- name: Setup dotnet 3.1.402
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 3.1.301
|
||||
dotnet-version: 3.1.402
|
||||
|
||||
- name: Setup dotnet 5.0.100
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 5.0.100
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
@@ -90,10 +95,15 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup dotnet
|
||||
- name: Setup dotnet 3.1.402
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 3.1.301
|
||||
dotnet-version: 3.1.402
|
||||
|
||||
- name: Setup dotnet 5.0.100
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 5.0.100
|
||||
|
||||
- name: Publish
|
||||
shell: bash
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -88,3 +88,5 @@ packages
|
||||
|
||||
# Windows
|
||||
Thumbs.db
|
||||
|
||||
*.received.*
|
||||
@@ -88,7 +88,7 @@ Spectre.Consoleでできることを見るために、
|
||||
|
||||
|
||||
```
|
||||
> dotnet tool install -g dotnet-example
|
||||
> dotnet tool restore
|
||||
```
|
||||
|
||||
このリポジトリで提供している例が一覧表示されます
|
||||
@@ -381,8 +381,8 @@ AnsiConsole.WriteException(ex);
|
||||
|
||||
```csharp
|
||||
AnsiConsole.WriteException(ex,
|
||||
ExceptionFormat.ShortenPaths | ExceptionFormat.ShortenTypes |
|
||||
ExceptionFormat.ShortenMethods | ExceptionFormat.ShowLinks);
|
||||
ExceptionFormats.ShortenPaths | ExceptionFormats.ShortenTypes |
|
||||
ExceptionFormats.ShortenMethods | ExceptionFormats.ShowLinks);
|
||||
```
|
||||
|
||||

|
||||
|
||||
112
README.md
112
README.md
@@ -2,19 +2,17 @@
|
||||
|
||||
_[](https://www.nuget.org/packages/spectre.console)_
|
||||
|
||||
A .NET Standard 2.0 library that makes it easier to create beautiful console applications.
|
||||
A .NET 5/.NET Standard 2.0 library that makes it easier to create beautiful, cross platform, console applications.
|
||||
It is heavily inspired by the excellent [Rich library](https://github.com/willmcgugan/rich)
|
||||
for Python.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [Features](#features)
|
||||
2. [Example](#example)
|
||||
3. [Installing](#installing)
|
||||
4. [Usage](#usage)
|
||||
4.1. [Using the static API](#using-the-static-api)
|
||||
4.2. [Creating a console](#creating-a-console)
|
||||
5. [Running examples](#running-examples)
|
||||
2. [Installing](#installing)
|
||||
3. [Documentation](#documentation)
|
||||
4. [Examples](#examples)
|
||||
5. [License](#license)
|
||||
|
||||
## Features
|
||||
|
||||
@@ -25,116 +23,50 @@ for Python.
|
||||
and blinking text.
|
||||
* Supports 3/4/8/24-bit colors in the terminal.
|
||||
The library will detect the capabilities of the current terminal
|
||||
and downgrade colors as needed.
|
||||
and downgrade colors as needed.
|
||||
|
||||
## Example
|
||||
|
||||

|
||||
|
||||
## Installing
|
||||
|
||||
The fastest way of getting started using Spectre.Console is to install the NuGet package.
|
||||
The fastest way of getting started using `Spectre.Console` is to install the NuGet package.
|
||||
|
||||
```csharp
|
||||
dotnet add package Spectre.Console
|
||||
```
|
||||
|
||||
## Usage
|
||||
## Documentation
|
||||
|
||||
The `Spectre.Console` API is stateful and is not thread-safe.
|
||||
If you need to write to the console from different threads, make sure that
|
||||
you take appropriate precautions, just like when you use the
|
||||
regular `System.Console` API.
|
||||
The documentation for `Spectre.Console` can be found at
|
||||
https://spectresystems.github.io/spectre.console/
|
||||
|
||||
If the current terminal does not support ANSI escape sequences,
|
||||
`Spectre.Console` will fallback to using the `System.Console` API.
|
||||
## Examples
|
||||
|
||||
_NOTE: This library is currently under development and API's
|
||||
might change or get removed at any point up until a 1.0 release._
|
||||
|
||||
### Using the static API
|
||||
|
||||
The static API is perfect when you just want to output text
|
||||
like you usually do with the `System.Console` API, but prettier.
|
||||
|
||||
```csharp
|
||||
AnsiConsole.Foreground = Color.CornflowerBlue;
|
||||
AnsiConsole.Decoration = Decoration.Underline | Decoration.Bold;
|
||||
AnsiConsole.WriteLine("Hello World!");
|
||||
|
||||
AnsiConsole.Reset();
|
||||
AnsiConsole.MarkupLine("[bold yellow on red]{0}[/] [underline]world[/]!", "Goodbye");
|
||||
```
|
||||
|
||||
If you want to get a reference to the default `IAnsiConsole`,
|
||||
you can access it via `AnsiConsole.Console`.
|
||||
|
||||
### Creating a console
|
||||
|
||||
Sometimes it's useful to explicitly create a console with specific
|
||||
capabilities, such as during unit testing when you want control
|
||||
over the environment your code runs in.
|
||||
|
||||
It's recommended to not use `AnsiConsole` in code that run as
|
||||
part of a unit test.
|
||||
|
||||
```csharp
|
||||
IAnsiConsole console = AnsiConsole.Create(
|
||||
new AnsiConsoleSettings()
|
||||
{
|
||||
Ansi = AnsiSupport.Yes,
|
||||
ColorSystem = ColorSystemSupport.TrueColor,
|
||||
Out = new StringWriter(),
|
||||
});
|
||||
```
|
||||
|
||||
_NOTE: Even if you can specify a specific color system to use
|
||||
when manually creating a console, remember that the user's terminal
|
||||
might not be able to use it, so unless you're creating an IAnsiConsole
|
||||
for testing, always use `ColorSystemSupport.Detect` and `AnsiSupport.Detect`._
|
||||
|
||||
## Running examples
|
||||
|
||||
To see Spectre.Console in action, install the
|
||||
To see `Spectre.Console` in action, install the
|
||||
[dotnet-example](https://github.com/patriksvensson/dotnet-example)
|
||||
global tool.
|
||||
|
||||
```
|
||||
> dotnet tool install -g dotnet-example
|
||||
> dotnet tool restore
|
||||
```
|
||||
|
||||
Now you can list available examples in this repository:
|
||||
|
||||
```
|
||||
> dotnet example
|
||||
|
||||
╭────────────┬───────────────────────────────────────┬──────────────────────────────────────────────────────╮
|
||||
│ Name │ Path │ Description │
|
||||
├────────────┼───────────────────────────────────────┼──────────────────────────────────────────────────────┤
|
||||
│ Borders │ examples/Borders/Borders.csproj │ Demonstrates the different kind of borders. │
|
||||
│ Calendars │ examples/Calendars/Calendars.csproj │ Demonstrates how to render calendars. │
|
||||
│ Colors │ examples/Colors/Colors.csproj │ Demonstrates how to use colors in the console. │
|
||||
│ Columns │ examples/Columns/Columns.csproj │ Demonstrates how to render data into columns. │
|
||||
│ Emojis │ examples/Emojis/Emojis.csproj │ Demonstrates how to render emojis. │
|
||||
│ Exceptions │ examples/Exceptions/Exceptions.csproj │ Demonstrates how to render formatted exceptions. │
|
||||
│ Grids │ examples/Grids/Grids.csproj │ Demonstrates how to render grids in a console. │
|
||||
│ Info │ examples/Info/Info.csproj │ Displays the capabilities of the current console. │
|
||||
│ Links │ examples/Links/Links.csproj │ Demonstrates how to render links in a console. │
|
||||
│ Panels │ examples/Panels/Panels.csproj │ Demonstrates how to render items in panels. │
|
||||
│ Rules │ examples/Rules/Rules.csproj │ Demonstrates how to render horizontal rules (lines). │
|
||||
│ Tables │ examples/Tables/Tables.csproj │ Demonstrates how to render tables in a console. │
|
||||
╰────────────┴───────────────────────────────────────┴──────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
||||
And to run an example:
|
||||
|
||||
```
|
||||
> dotnet example tables
|
||||
┌──────────┬──────────┬────────┐
|
||||
│ Foo │ Bar │ Baz │
|
||||
├──────────┼──────────┼────────┤
|
||||
│ Hello │ World! │ │
|
||||
│ Bonjour │ le │ monde! │
|
||||
│ Hej │ Världen! │ │
|
||||
└──────────┴──────────┴────────┘
|
||||
```
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Copyright © Spectre Systems.
|
||||
|
||||
Spectre.Console is provided as-is under the MIT license. For more information see LICENSE.
|
||||
|
||||
* For SixLabors.ImageSharp, see https://github.com/SixLabors/ImageSharp/blob/master/LICENSE
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
|
||||
<DefaultItemExcludes>$(DefaultItemExcludes);output\**;.gitignore</DefaultItemExcludes>
|
||||
<MinVerSkip Condition="'$(Configuration)' == 'Debug'">true</MinVerSkip>
|
||||
@@ -31,8 +31,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Statiq.Web" Version="1.0.0-beta.5" />
|
||||
<PackageReference Include="MinVer" PrivateAssets="All" Version="2.3.0" />
|
||||
<PackageReference Include="Statiq.Web" Version="1.0.0-beta.13" />
|
||||
<PackageReference Include="MinVer" PrivateAssets="All" Version="2.3.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -10,7 +10,7 @@ The documentation site uses [Statiq](https://statiq.dev), a static site generato
|
||||
> dotnet run preview --virtual-dir "spectre.console"
|
||||
```
|
||||
|
||||
After the build is complete, you can navigate to [http://localhost:5080/spectre.consle](http://localhost:5080/spectre.console).
|
||||
After the build is complete, you can navigate to [http://localhost:5080/spectre.console](http://localhost:5080/spectre.console).
|
||||
|
||||
**Note that the site runs under a virtual directory.**
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
<div class="sidebar-nav-item @(Document.IdEquals(root) ? "active" : null)">
|
||||
@if(root.ShowLink())
|
||||
{
|
||||
@Html.DocumentLink(root)
|
||||
@Html.DocumentLink(root)
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -140,6 +140,11 @@
|
||||
|
||||
@foreach (IDocument document in OutputPages.GetChildrenOf(root).OnlyVisible())
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(document.GetTitle()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
DocumentList<IDocument> documentChildren = OutputPages.GetChildrenOf(document);
|
||||
<div class="sidebar-nav-item @(Document.IdEquals(document) ? "active" : null) @(documentChildren.Any() ? "has-children" : null)">
|
||||
@if(document.ShowLink())
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 24 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.4 MiB |
@@ -19,8 +19,8 @@ the hyperlinks are clickable is up to the terminal.
|
||||
|
||||
```csharp
|
||||
AnsiConsole.WriteException(ex,
|
||||
ExceptionFormat.ShortenPaths | ExceptionFormat.ShortenTypes |
|
||||
ExceptionFormat.ShortenMethods | ExceptionFormat.ShowLinks);
|
||||
ExceptionFormats.ShortenPaths | ExceptionFormats.ShortenTypes |
|
||||
ExceptionFormats.ShortenMethods | ExceptionFormats.ShowLinks);
|
||||
```
|
||||
|
||||
<img src="assets/images/compact_exception.png" style="max-width: 100%;">
|
||||
@@ -36,15 +36,15 @@ AnsiConsole.WriteException(ex, new ExceptionSettings
|
||||
Format = ExceptionFormats.ShortenEverything | ExceptionFormats.ShowLinks,
|
||||
Style = new ExceptionStyle
|
||||
{
|
||||
Exception = Style.WithForeground(Color.Grey),
|
||||
Message = Style.WithForeground(Color.White),
|
||||
NonEmphasized = Style.WithForeground(Color.Cornsilk1),
|
||||
Parenthesis = Style.WithForeground(Color.Cornsilk1),
|
||||
Method = Style.WithForeground(Color.Red),
|
||||
ParameterName = Style.WithForeground(Color.Cornsilk1),
|
||||
ParameterType = Style.WithForeground(Color.Red),
|
||||
Path = Style.WithForeground(Color.Red),
|
||||
LineNumber = Style.WithForeground(Color.Cornsilk1),
|
||||
Exception = new Style().Foreground(Color.Grey),
|
||||
Message = new Style().Foreground(Color.White),
|
||||
NonEmphasized = new Style().Foreground(Color.Cornsilk1),
|
||||
Parenthesis = new Style().Foreground(Color.Cornsilk1),
|
||||
Method = new Style().Foreground(Color.Red),
|
||||
ParameterName = new Style().Foreground(Color.Cornsilk1),
|
||||
ParameterType = new Style().Foreground(Color.Red),
|
||||
Path = new Style().Foreground(Color.Red),
|
||||
LineNumber = new Style().Foreground(Color.Cornsilk1),
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Title: Welcome
|
||||
Title: Welcome
|
||||
Order: 0
|
||||
---
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ The class `Markup` allows you to output rich text to the console.
|
||||
|
||||
# Syntax
|
||||
|
||||
Console markup uses a syntax inspired by bbcode. If you write the style (see Styles)
|
||||
Console markup uses a syntax inspired by bbcode. If you write the style (see [Styles](xref:styles))
|
||||
in square brackets, e.g. `[bold red]`, that style will apply until it is closed with a `[/]`.
|
||||
|
||||
```csharp
|
||||
@@ -21,6 +21,7 @@ rendering of `IRenderable` also have overloads for rendering rich text.
|
||||
var table = new Table();
|
||||
table.AddColumn(new TableColumn(new Markup("[yellow]Foo[/]")));
|
||||
table.AddColumn(new TableColumn("[blue]Bar[/]"));
|
||||
AnsiConsole.Render(table);
|
||||
```
|
||||
|
||||
# Convenience methods
|
||||
@@ -43,20 +44,24 @@ AnsiConsole.Markup("[[Hello]] "); // [Hello]
|
||||
AnsiConsole.Markup("[red][[World]][/]"); // [World]
|
||||
```
|
||||
|
||||
You can also use the `SafeMarkup` extension method.
|
||||
You can also use the `EscapeMarkup` extension method.
|
||||
|
||||
```csharp
|
||||
AnsiConsole.Markup("[red]{0}[/]", "Hello [World]".SafeMarkup());
|
||||
AnsiConsole.Markup("[red]{0}[/]", "Hello [World]".EscapeMarkup());
|
||||
```
|
||||
You can also use the `Markup.Escape` method.
|
||||
|
||||
```csharp
|
||||
AnsiConsole.Markup("[red]{0}[/]", Markup.Escape("Hello [World]"));
|
||||
```
|
||||
# Setting background color
|
||||
|
||||
You can set the background color in markup by prefixing the color with
|
||||
`on`.
|
||||
|
||||
```
|
||||
[bold yellow on blue]Hello[/]
|
||||
[default on blue]World[/]
|
||||
```csharp
|
||||
AnsiConsole.Markup("[bold yellow on blue]Hello[/]");
|
||||
AnsiConsole.Markup("[default on blue]World[/]");
|
||||
```
|
||||
|
||||
# Rendering emojis
|
||||
@@ -64,7 +69,7 @@ You can set the background color in markup by prefixing the color with
|
||||
To output an emoji as part of markup, you can use emoji shortcodes.
|
||||
|
||||
```csharp
|
||||
AnsiConsole.MarkupLine("Hello :globe_showing_europe_africa:!");
|
||||
AnsiConsole.Markup("Hello :globe_showing_europe_africa:!");
|
||||
```
|
||||
|
||||
For a list of emoji, see the [Emojis](xref:emojis) appendix section.
|
||||
|
||||
99
docs/input/prompt.md
Normal file
99
docs/input/prompt.md
Normal file
@@ -0,0 +1,99 @@
|
||||
Title: Prompt
|
||||
Order: 4
|
||||
---
|
||||
|
||||
Sometimes you want to get some input from the user, and for this
|
||||
you can use the `Prompt<TResult>`.
|
||||
|
||||
# Confirmation
|
||||
|
||||
```csharp
|
||||
if (!AnsiConsole.Confirm("Run example?"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
```
|
||||
|
||||
```text
|
||||
Run example? [y/n] (y): _
|
||||
```
|
||||
|
||||
# Simple
|
||||
|
||||
```csharp
|
||||
// Ask for the user's name
|
||||
string name = AnsiConsole.Ask<string>("What's your [green]name[/]?");
|
||||
|
||||
// Ask for the user's age
|
||||
int age = AnsiConsole.Ask<int>("What's your [green]age[/]?");
|
||||
```
|
||||
|
||||
```text
|
||||
What's your name? Patrik
|
||||
What's your age? 37
|
||||
```
|
||||
|
||||
# Choices
|
||||
|
||||
```csharp
|
||||
var fruit = AnsiConsole.Prompt(
|
||||
new TextPrompt<string>("What's your [green]favorite fruit[/]?")
|
||||
.InvalidChoiceMessage("[red]That's not a valid fruit[/]")
|
||||
.DefaultValue("Orange")
|
||||
.AddChoice("Apple")
|
||||
.AddChoice("Banana")
|
||||
.AddChoice("Orange"));
|
||||
```
|
||||
|
||||
```text
|
||||
What's your favorite fruit? [Apple/Banana/Orange] (Orange): _
|
||||
```
|
||||
|
||||
# Validation
|
||||
|
||||
```csharp
|
||||
var age = AnsiConsole.Prompt(
|
||||
new TextPrompt<int>("What's the secret number?")
|
||||
.Validate(age =>
|
||||
{
|
||||
return age switch
|
||||
{
|
||||
< 99 => ValidationResult.Error("[red]Too low[/]"),
|
||||
> 99 => ValidationResult.Error("[red]Too high[/]"),
|
||||
_ => ValidationResult.Success(),
|
||||
};
|
||||
}));
|
||||
```
|
||||
|
||||
```text
|
||||
What's the secret number? 32
|
||||
Too low
|
||||
What's the secret number? 102
|
||||
Too high
|
||||
What's the secret number? _
|
||||
```
|
||||
|
||||
# Secrets
|
||||
|
||||
```csharp
|
||||
var password = AnsiConsole.Prompt(
|
||||
new TextPrompt<string>("Enter [green]password[/]")
|
||||
.PromptStyle("red")
|
||||
.Secret());
|
||||
```
|
||||
|
||||
```text
|
||||
Enter password: ************_
|
||||
```
|
||||
|
||||
# Optional
|
||||
|
||||
```csharp
|
||||
var color = AnsiConsole.Prompt(
|
||||
new TextPrompt<string>("[grey][[Optional]][/] [green]Favorite color[/]?")
|
||||
.AllowEmpty());
|
||||
```
|
||||
|
||||
```text
|
||||
[Optional] Favorite color? _
|
||||
```
|
||||
@@ -5,7 +5,7 @@ Order: 1
|
||||
The fastest way of getting started using Spectre.Console is
|
||||
to install the NuGet package.
|
||||
|
||||
```shell
|
||||
```text
|
||||
> dotnet add package Spectre.Console
|
||||
```
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Title: Calendar
|
||||
Order: 4
|
||||
Order: 2
|
||||
RedirectFrom: calendar
|
||||
---
|
||||
|
||||
@@ -12,7 +12,9 @@ To render a calendar, create a `Calendar` instance with a target date.
|
||||
```csharp
|
||||
var calendar = new Calendar(2020,10);
|
||||
AnsiConsole.Render(calendar);
|
||||
```
|
||||
|
||||
```text
|
||||
2020 October
|
||||
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
|
||||
@@ -32,20 +34,22 @@ You can set the calendar's culture to show localized weekdays.
|
||||
|
||||
```csharp
|
||||
var calendar = new Calendar(2020,10);
|
||||
calendar.SetCulture("ja-JP");
|
||||
calendar.Culture("ja-JP");
|
||||
AnsiConsole.Render(calendar);
|
||||
```
|
||||
|
||||
2020年10月
|
||||
┌────┬────┬────┬────┬────┬────┬────┐
|
||||
│ 日 │ 月 │ 火 │ 水 │ 木 │ 金 │ 土 │
|
||||
├────┼────┼────┼────┼────┼────┼────┤
|
||||
│ │ │ │ │ 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 │
|
||||
│ │ │ │ │ │ │ │
|
||||
└────┴────┴────┴────┴────┴────┴────┘
|
||||
```text
|
||||
Oktober 2020
|
||||
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
│ Mån │ Tis │ Ons │ Tor │ Fre │ Lör │ Sön │
|
||||
├─────┼─────┼─────┼─────┼─────┼─────┼─────┤
|
||||
│ │ │ │ 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 │ │
|
||||
│ │ │ │ │ │ │ │
|
||||
└─────┴─────┴─────┴─────┴─────┴─────┴─────┘
|
||||
```
|
||||
|
||||
## Header
|
||||
@@ -54,9 +58,11 @@ You can hide the calendar header.
|
||||
|
||||
```csharp
|
||||
var calendar = new Calendar(2020,10);
|
||||
calendar.ShowHeader = false;
|
||||
calendar.ShowHeader();
|
||||
AnsiConsole.Render(calendar);
|
||||
```
|
||||
|
||||
```text
|
||||
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
|
||||
├─────┼─────┼─────┼─────┼─────┼─────┼─────┤
|
||||
@@ -72,13 +78,13 @@ AnsiConsole.Render(calendar);
|
||||
You can set the header style of the calendar.
|
||||
|
||||
```csharp
|
||||
var calendar = new Calendar(2020,10);
|
||||
calendar.SetHeaderStyle(Style.Parse("blue bold"));
|
||||
var calendar = new Calendar(2020, 10);
|
||||
calendar.HeaderStyle(Style.Parse("blue bold"));
|
||||
AnsiConsole.Render(calendar);
|
||||
```
|
||||
|
||||
|
||||
## Calendar Event
|
||||
## Calendar Events
|
||||
|
||||
You can add an event to the calendar.
|
||||
If a date has an event associated with it, the date gets highlighted in the calendar.
|
||||
@@ -87,7 +93,9 @@ If a date has an event associated with it, the date gets highlighted in the cale
|
||||
var calendar = new Calendar(2020,10);
|
||||
calendar.AddCalendarEvent(2020, 10, 11);
|
||||
AnsiConsole.Render(calendar);
|
||||
```
|
||||
|
||||
```text
|
||||
2020 October
|
||||
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
|
||||
@@ -106,9 +114,8 @@ AnsiConsole.Render(calendar);
|
||||
You can set the highlight style for a calendar event via `SetHighlightStyle`.
|
||||
|
||||
```csharp
|
||||
var calendar = new Calendar(2020,10);
|
||||
var calendar = new Calendar(2020, 10);
|
||||
calendar.AddCalendarEvent(2020, 10, 11);
|
||||
calendar.SetHighlightStyle(Style.Parse("yellow bold"));
|
||||
calendar.HighlightStyle(Style.Parse("yellow bold"));
|
||||
AnsiConsole.Render(calendar);
|
||||
|
||||
```
|
||||
|
||||
106
docs/input/widgets/canvas-image.md
Normal file
106
docs/input/widgets/canvas-image.md
Normal file
@@ -0,0 +1,106 @@
|
||||
Title: Canvas Image
|
||||
Order: 5
|
||||
---
|
||||
|
||||
To add [ImageSharp](https://github.com/SixLabors/ImageSharp) superpowers to
|
||||
your console application to draw images, you will need to install
|
||||
the [Spectre.Console.ImageSharp](https://www.nuget.org/packages/Spectre.Console.ImageSharp) NuGet package.
|
||||
|
||||
```text
|
||||
> dotnet add package Spectre.Console.ImageSharp
|
||||
```
|
||||
|
||||
# Loading images
|
||||
|
||||
Once you've added the `Spectre.Console.ImageSharp` NuGet package,
|
||||
you can create a new instance of `CanvasImage` to draw images to the console.
|
||||
|
||||
```csharp
|
||||
// Load an image
|
||||
var image = new CanvasImage("cake.png");
|
||||
|
||||
// Set the max width of the image.
|
||||
// If no max width is set, the image will take
|
||||
// up as much space as there is available.
|
||||
image.MaxWidth(16);
|
||||
|
||||
// Render the image to the console
|
||||
AnsiConsole.Render(image);
|
||||
```
|
||||
|
||||
## Result
|
||||
|
||||
<pre style="font-size:90%;font-family:consolas,'Courier New',monospace;line-height: normal; padding: 0px;background-color: #222222; padding: 20px;">
|
||||
<span> </span><span style="background-color: #542813"> </span><span style="background-color: #572F1B"> </span><span style="background-color: #4E1F09"> </span><span style="background-color: #5B3826"> </span><span style="background-color: #5E3A29"> </span><span style="background-color: #532611"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #562E1B"> </span><span style="background-color: #634737"> </span><span style="background-color: #562E1A"> </span><span style="background-color: #5D4132"> </span><span style="background-color: #6D584B"> </span><span style="background-color: #624332"> </span><span style="background-color: #562B17"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #512714"> </span><span style="background-color: #654E40"> </span><span style="background-color: #705243"> </span><span style="background-color: #745749"> </span><span style="background-color: #6D5B4F"> </span><span style="background-color: #715E52"> </span><span style="background-color: #644636"> </span><span style="background-color: #6A4433"> </span><span style="background-color: #542916"> </span><span style="background-color: #431C0B"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #491E0A"> </span><span style="background-color: #5C3523"> </span><span style="background-color: #695346"> </span><span style="background-color: #705C4F"> </span><span style="background-color: #654838"> </span><span style="background-color: #654A3A"> </span><span style="background-color: #726154"> </span><span style="background-color: #715D50"> </span><span style="background-color: #B8A79F"> </span><span style="background-color: #AE988F"> </span><span style="background-color: #6F4A39"> </span><span style="background-color: #441906"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #532916"> </span><span style="background-color: #8A6C5E"> </span><span style="background-color: #C2B3AB"> </span><span style="background-color: #8B786E"> </span><span style="background-color: #6B584C"> </span><span style="background-color: #695143"> </span><span style="background-color: #6C5648"> </span><span style="background-color: #6F5D51"> </span><span style="background-color: #816A55"> </span><span style="background-color: #E7E1DA"> </span><span style="background-color: #F9F5EE"> </span><span style="background-color: #BAA593"> </span><span style="background-color: #61381F"> </span><span> </span>
|
||||
<span style="background-color: #421C0A"> </span><span style="background-color: #603826"> </span><span style="background-color: #9E8479"> </span><span style="background-color: #E2DAD6"> </span><span style="background-color: #FBF9F6"> </span><span style="background-color: #F0EADF"> </span><span style="background-color: #C4B59D"> </span><span style="background-color: #9D8663"> </span><span style="background-color: #786451"> </span><span style="background-color: #705D4E"> </span><span style="background-color: #BFA052"> </span><span style="background-color: #FEE88B"> </span><span style="background-color: #FDE580"> </span><span style="background-color: #E2C362"> </span><span style="background-color: #794E1D"> </span><span> </span>
|
||||
<span style="background-color: #4B1D05"> </span><span style="background-color: #A6844C"> </span><span style="background-color: #E9D595"> </span><span style="background-color: #F1DC92"> </span><span style="background-color: #F5DD83"> </span><span style="background-color: #FBE278"> </span><span style="background-color: #FFE36E"> </span><span style="background-color: #F1D25E"> </span><span style="background-color: #866F4B"> </span><span style="background-color: #726256"> </span><span style="background-color: #967945"> </span><span style="background-color: #F5D456"> </span><span style="background-color: #F8D756"> </span><span style="background-color: #E1BE4A"> </span><span style="background-color: #7D511B"> </span><span> </span>
|
||||
<span style="background-color: #4F2005"> </span><span style="background-color: #C9A441"> </span><span style="background-color: #FFE05C"> </span><span style="background-color: #FEDF5B"> </span><span style="background-color: #FCDC59"> </span><span style="background-color: #F7D555"> </span><span style="background-color: #E5C04A"> </span><span style="background-color: #795E3B"> </span><span style="background-color: #726256"> </span><span style="background-color: #755F4C"> </span><span style="background-color: #A17124"> </span><span style="background-color: #AE7414"> </span><span style="background-color: #AE791D"> </span><span style="background-color: #794D18"> </span><span> </span>
|
||||
<span style="background-color: #4E1F04"> </span><span style="background-color: #B78D31"> </span><span style="background-color: #DDB33E"> </span><span style="background-color: #D0A132"> </span><span style="background-color: #C28F25"> </span><span style="background-color: #B67E1A"> </span><span style="background-color: #AC7111"> </span><span style="background-color: #9E610A"> </span><span style="background-color: #5F3212"> </span><span style="background-color: #6A574B"> </span><span style="background-color: #726256"> </span><span style="background-color: #744D2A"> </span><span style="background-color: #955401"> </span><span style="background-color: #8C5106"> </span><span style="background-color: #5F310C"> </span><span> </span>
|
||||
<span style="background-color: #4B1A00"> </span><span style="background-color: #854903"> </span><span style="background-color: #9B5A02"> </span><span style="background-color: #995700"> </span><span style="background-color: #935200"> </span><span style="background-color: #592402"> </span><span style="background-color: #5B3F30"> </span><span style="background-color: #726256"> </span><span style="background-color: #705A4A"> </span><span style="background-color: #844C0C"> </span><span style="background-color: #824400"> </span><span style="background-color: #4C1B00"> </span><span> </span>
|
||||
<span style="background-color: #4B1A00"> </span><span style="background-color: #824500"> </span><span style="background-color: #995700"> </span><span style="background-color: #935200"> </span><span style="background-color: #592300"> </span><span style="background-color: #4F2411"> </span><span style="background-color: #6B584C"> </span><span style="background-color: #736256"> </span><span style="background-color: #734E2C"> </span><span style="background-color: #7C4101"> </span><span style="background-color: #4C1B00"> </span><span> </span>
|
||||
<span style="background-color: #4B1A00"> </span><span style="background-color: #824500"> </span><span style="background-color: #995700"> </span><span style="background-color: #935200"> </span><span style="background-color: #592300"> </span><span style="background-color: #4A1902"> </span><span style="background-color: #5C4031"> </span><span style="background-color: #726256"> </span><span style="background-color: #705B4B"> </span><span style="background-color: #6A390F"> </span><span style="background-color: #4C1A00"> </span><span> </span>
|
||||
<span style="background-color: #4B1A00"> </span><span style="background-color: #824500"> </span><span style="background-color: #995700"> </span><span style="background-color: #935200"> </span><span style="background-color: #592300"> </span><span style="background-color: #4A1700"> </span><span style="background-color: #4F2512"> </span><span style="background-color: #6B594D"> </span><span style="background-color: #736256"> </span><span style="background-color: #634432"> </span><span style="background-color: #4C1D08"> </span><span> </span>
|
||||
<span style="background-color: #4B1A00"> </span><span style="background-color: #814400"> </span><span style="background-color: #955400"> </span><span style="background-color: #915100"> </span><span style="background-color: #8C4D00"> </span><span style="background-color: #864800"> </span><span style="background-color: #7F4301"> </span><span style="background-color: #743A01"> </span><span style="background-color: #521E01"> </span><span style="background-color: #4A1700"> </span><span style="background-color: #4A1902"> </span><span style="background-color: #5D4132"> </span><span style="background-color: #726256"> </span><span style="background-color: #6F5B4E"> </span><span style="background-color: #5D3A28"> </span><span style="background-color: #53220C"> </span>
|
||||
<span style="background-color: #471801"> </span><span style="background-color: #642D01"> </span><span style="background-color: #6B3301"> </span><span style="background-color: #642E02"> </span><span style="background-color: #5D2902"> </span><span style="background-color: #542203"> </span><span style="background-color: #4C1C04"> </span><span style="background-color: #461905"> </span><span style="background-color: #4A1C07"> </span><span style="background-color: #4C1A03"> </span><span style="background-color: #4B1801"> </span><span style="background-color: #502613"> </span><span style="background-color: #69564A"> </span><span style="background-color: #705F54"> </span><span style="background-color: #604232"> </span><span style="background-color: #51200A"> </span>
|
||||
<span style="background-color: #411806"> </span><span style="background-color: #431A07"> </span><span style="background-color: #411D0D"> </span><span> </span><span style="background-color: #4D1B05"> </span><span style="background-color: #4D1D07"> </span><span style="background-color: #533324"> </span><span style="background-color: #583E30"> </span><span style="background-color: #53301F"> </span><span style="background-color: #53230D"> </span>
|
||||
</pre>
|
||||
|
||||
# Manipulating images
|
||||
|
||||
You can take full advantage of using [ImageSharp](https://github.com/SixLabors/ImageSharp)
|
||||
and manipulate images directly via the [ImageSharp Processing API](https://docs.sixlabors.com/api/ImageSharp/SixLabors.ImageSharp.Processing.html).
|
||||
|
||||
```csharp
|
||||
// Load an image
|
||||
var image = new CanvasImage("cake.png");
|
||||
image.MaxWidth(32);
|
||||
|
||||
// Set a sampler that will be used when scaling the image.
|
||||
image.BilinearResampler();
|
||||
|
||||
// Mutate the image using ImageSharp
|
||||
image.Mutate(ctx => ctx.Grayscale().Rotate(-45).EntropyCrop());
|
||||
|
||||
// Render the image to the console
|
||||
AnsiConsole.Render(image);
|
||||
```
|
||||
|
||||
# Result
|
||||
|
||||
<pre style="font-size:90%;font-family:consolas,'Courier New',monospace;line-height: normal; padding: 0px;background-color: #222222; padding: 20px;">
|
||||
<span> </span><span style="background-color: #282828"> </span><span style="background-color: #222222"> </span><span style="background-color: #232323"> </span><span style="background-color: #353535"> </span><span style="background-color: #4B4B4B"> </span><span style="background-color: #595959"> </span><span style="background-color: #3B3B3B"> </span><span style="background-color: #202020"> </span><span style="background-color: #191919"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #343434"> </span><span style="background-color: #2B2B2B"> </span><span style="background-color: #292929"> </span><span style="background-color: #272727"> </span><span style="background-color: #252525"> </span><span style="background-color: #292929"> </span><span style="background-color: #555555"> </span><span style="background-color: #929292"> </span><span style="background-color: #C7C7C7"> </span><span style="background-color: #E5E5E5"> </span><span style="background-color: #F0F0F0"> </span><span style="background-color: #E4E4E4"> </span><span style="background-color: #A8A8A8"> </span><span style="background-color: #515151"> </span><span style="background-color: #202020"> </span><span style="background-color: #191919"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #2E2E2E"> </span><span style="background-color: #2B2B2B"> </span><span style="background-color: #333333"> </span><span style="background-color: #373737"> </span><span style="background-color: #3C3C3C"> </span><span style="background-color: #414141"> </span><span style="background-color: #474747"> </span><span style="background-color: #4B4B4B"> </span><span style="background-color: #454545"> </span><span style="background-color: #828282"> </span><span style="background-color: #E0E0E0"> </span><span style="background-color: #FFFFFF"> </span><span style="background-color: #FCFCFC"> </span><span style="background-color: #DEDEDE"> </span><span style="background-color: #DADADA"> </span><span style="background-color: #BCBCBC"> </span><span style="background-color: #515151"> </span><span style="background-color: #202020"> </span><span style="background-color: #191919"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #272727"> </span><span style="background-color: #414141"> </span><span style="background-color: #5C5C5C"> </span><span style="background-color: #616161"> </span><span style="background-color: #636363"> </span><span style="background-color: #656565"> </span><span style="background-color: #666666"> </span><span style="background-color: #656565"> </span><span style="background-color: #5A5A5A"> </span><span style="background-color: #707070"> </span><span style="background-color: #F3F3F3"> </span><span style="background-color: #FFFFFF"> </span><span style="background-color: #F0F0F0"> </span><span style="background-color: #DDDDDD"> </span><span style="background-color: #BABABA"> </span><span style="background-color: #505050"> </span><span style="background-color: #202020"> </span><span style="background-color: #1B1B1B"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #242424"> </span><span style="background-color: #3B3B3B"> </span><span style="background-color: #545454"> </span><span style="background-color: #606060"> </span><span style="background-color: #656565"> </span><span style="background-color: #666666"> </span><span style="background-color: #606060"> </span><span style="background-color: #575757"> </span><span style="background-color: #E8E8E8"> </span><span style="background-color: #F6F6F6"> </span><span style="background-color: #E1E1E1"> </span><span style="background-color: #DDDDDD"> </span><span style="background-color: #D9D9D9"> </span><span style="background-color: #A0A0A0"> </span><span style="background-color: #989898"> </span><span style="background-color: #4E4E4E"> </span><span style="background-color: #222222"> </span><span> </span>
|
||||
<span style="background-color: #2F2F2F"> </span><span style="background-color: #2C2C2C"> </span><span style="background-color: #222222"> </span><span style="background-color: #282828"> </span><span style="background-color: #2D2D2D"> </span><span style="background-color: #3E3E3E"> </span><span style="background-color: #4D4D4D"> </span><span style="background-color: #616161"> </span><span style="background-color: #636363"> </span><span style="background-color: #666666"> </span><span style="background-color: #606060"> </span><span style="background-color: #535353"> </span><span style="background-color: #D4D4D4"> </span><span style="background-color: #E2E2E2"> </span><span style="background-color: #DDDDDD"> </span><span style="background-color: #DCDCDC"> </span><span style="background-color: #AFAFAF"> </span><span style="background-color: #666666"> </span><span style="background-color: #6F6F6F"> </span><span style="background-color: #717171"> </span><span style="background-color: #242424"> </span><span style="background-color: #191919"> </span><span> </span>
|
||||
<span style="background-color: #2C2C2C"> </span><span style="background-color: #343434"> </span><span style="background-color: #2E2E2E"> </span><span style="background-color: #262626"> </span><span style="background-color: #404040"> </span><span style="background-color: #868686"> </span><span style="background-color: #4D4D4D"> </span><span style="background-color: #5A5A5A"> </span><span style="background-color: #3D3D3D"> </span><span style="background-color: #474747"> </span><span style="background-color: #646464"> </span><span style="background-color: #616161"> </span><span style="background-color: #4D4D4D"> </span><span style="background-color: #9D9D9D"> </span><span style="background-color: #C8C8C8"> </span><span style="background-color: #DADADA"> </span><span style="background-color: #DDDDDD"> </span><span style="background-color: #C4C4C4"> </span><span style="background-color: #717171"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #595959"> </span><span style="background-color: #343434"> </span><span style="background-color: #1F1F1F"> </span><span style="background-color: #191919"> </span><span> </span>
|
||||
<span style="background-color: #343434"> </span><span style="background-color: #575757"> </span><span style="background-color: #555555"> </span><span style="background-color: #454545"> </span><span style="background-color: #4C4C4C"> </span><span style="background-color: #656565"> </span><span style="background-color: #5B5B5B"> </span><span style="background-color: #434343"> </span><span style="background-color: #3E3E3E"> </span><span style="background-color: #595959"> </span><span style="background-color: #666666"> </span><span style="background-color: #606060"> </span><span style="background-color: #595959"> </span><span style="background-color: #5E5E5E"> </span><span style="background-color: #787878"> </span><span style="background-color: #9E9E9E"> </span><span style="background-color: #797979"> </span><span style="background-color: #5E5E5E"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #575757"> </span><span style="background-color: #343434"> </span><span style="background-color: #1F1F1F"> </span><span style="background-color: #191919"> </span><span> </span>
|
||||
<span style="background-color: #2B2B2B"> </span><span style="background-color: #3B3B3B"> </span><span style="background-color: #575757"> </span><span style="background-color: #646464"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #5E5E5E"> </span><span style="background-color: #575757"> </span><span style="background-color: #3D3D3D"> </span><span style="background-color: #525252"> </span><span style="background-color: #656565"> </span><span style="background-color: #666666"> </span><span style="background-color: #656565"> </span><span style="background-color: #616161"> </span><span style="background-color: #595959"> </span><span style="background-color: #4B4B4B"> </span><span style="background-color: #454545"> </span><span style="background-color: #4B4B4B"> </span><span style="background-color: #555555"> </span><span style="background-color: #5D5D5D"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #575757"> </span><span style="background-color: #343434"> </span><span style="background-color: #1F1F1F"> </span><span style="background-color: #191919"> </span><span> </span>
|
||||
<span style="background-color: #3A3A3A"> </span><span style="background-color: #292929"> </span><span style="background-color: #323232"> </span><span style="background-color: #4A4A4A"> </span><span style="background-color: #626262"> </span><span style="background-color: #666666"> </span><span style="background-color: #656565"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #616161"> </span><span style="background-color: #5E5E5E"> </span><span style="background-color: #616161"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #666666"> </span><span style="background-color: #626262"> </span><span style="background-color: #575757"> </span><span style="background-color: #4B4B4B"> </span><span style="background-color: #454545"> </span><span style="background-color: #4A4A4A"> </span><span style="background-color: #545454"> </span><span style="background-color: #343434"> </span><span style="background-color: #1F1F1F"> </span><span style="background-color: #191919"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #252525"> </span><span style="background-color: #383838"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #616161"> </span><span style="background-color: #5B5B5B"> </span><span style="background-color: #505050"> </span><span style="background-color: #545454"> </span><span style="background-color: #8A8A8A"> </span><span style="background-color: #C5C5C5"> </span><span style="background-color: #959595"> </span><span style="background-color: #5E5E5E"> </span><span style="background-color: #636363"> </span><span style="background-color: #666666"> </span><span style="background-color: #626262"> </span><span style="background-color: #595959"> </span><span style="background-color: #4D4D4D"> </span><span style="background-color: #454545"> </span><span style="background-color: #414141"> </span><span style="background-color: #282828"> </span><span style="background-color: #1E1E1E"> </span><span style="background-color: #1D1D1D"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #212121"> </span><span style="background-color: #2C2C2C"> </span><span style="background-color: #4F4F4F"> </span><span style="background-color: #515151"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #898989"> </span><span style="background-color: #CDCDCD"> </span><span style="background-color: #E8E8E8"> </span><span style="background-color: #DEDEDE"> </span><span style="background-color: #D8D8D8"> </span><span style="background-color: #939393"> </span><span style="background-color: #4D4D4D"> </span><span style="background-color: #525252"> </span><span style="background-color: #5E5E5E"> </span><span style="background-color: #646464"> </span><span style="background-color: #666666"> </span><span style="background-color: #636363"> </span><span style="background-color: #5A5A5A"> </span><span style="background-color: #4A4A4A"> </span><span style="background-color: #383838"> </span><span style="background-color: #323232"> </span><span style="background-color: #2A2A2A"> </span><span style="background-color: #282828"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #272727"> </span><span style="background-color: #404040"> </span><span style="background-color: #C8C8C8"> </span><span style="background-color: #DFDFDF"> </span><span style="background-color: #F0F0F0"> </span><span style="background-color: #FDFDFD"> </span><span style="background-color: #F3F3F3"> </span><span style="background-color: #DFDFDF"> </span><span style="background-color: #DDDDDD"> </span><span style="background-color: #D7D7D7"> </span><span style="background-color: #757575"> </span><span style="background-color: #2B2B2B"> </span><span style="background-color: #333333"> </span><span style="background-color: #444444"> </span><span style="background-color: #535353"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #646464"> </span><span style="background-color: #666666"> </span><span style="background-color: #646464"> </span><span style="background-color: #5B5B5B"> </span><span style="background-color: #4F4F4F"> </span><span style="background-color: #3A3A3A"> </span><span style="background-color: #292929"> </span>
|
||||
<span> </span><span style="background-color: #242424"> </span><span style="background-color: #4F4F4F"> </span><span style="background-color: #E7E7E7"> </span><span style="background-color: #FFFFFF"> </span><span style="background-color: #F2F2F2"> </span><span style="background-color: #DFDFDF"> </span><span style="background-color: #DDDDDD"> </span><span style="background-color: #C2C2C2"> </span><span style="background-color: #6E6E6E"> </span><span style="background-color: #434343"> </span><span style="background-color: #242424"> </span><span style="background-color: #222222"> </span><span style="background-color: #282828"> </span><span style="background-color: #343434"> </span><span style="background-color: #454545"> </span><span style="background-color: #555555"> </span><span style="background-color: #606060"> </span><span style="background-color: #656565"> </span><span style="background-color: #666666"> </span><span style="background-color: #595959"> </span><span style="background-color: #313131"> </span>
|
||||
<span> </span><span style="background-color: #222222"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #F2F2F2"> </span><span style="background-color: #FFFFFF"> </span><span style="background-color: #F4F4F4"> </span><span style="background-color: #D7D7D7"> </span><span style="background-color: #DCDCDC"> </span><span style="background-color: #DDDDDD"> </span><span style="background-color: #D1D1D1"> </span><span style="background-color: #818181"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #5D5D5D"> </span><span style="background-color: #434343"> </span><span style="background-color: #242424"> </span><span style="background-color: #202020"> </span><span style="background-color: #222222"> </span><span style="background-color: #282828"> </span><span style="background-color: #353535"> </span><span style="background-color: #464646"> </span><span style="background-color: #565656"> </span><span style="background-color: #606060"> </span><span style="background-color: #656565"> </span><span style="background-color: #666666"> </span><span style="background-color: #585858"> </span><span style="background-color: #333333"> </span>
|
||||
<span> </span><span style="background-color: #222222"> </span><span style="background-color: #707070"> </span><span style="background-color: #FAFAFA"> </span><span style="background-color: #D2D2D2"> </span><span style="background-color: #D9D9D9"> </span><span style="background-color: #DDDDDD"> </span><span style="background-color: #D9D9D9"> </span><span style="background-color: #979797"> </span><span style="background-color: #616161"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #5D5D5D"> </span><span style="background-color: #434343"> </span><span style="background-color: #242424"> </span><span style="background-color: #202020"> </span><span style="background-color: #222222"> </span><span style="background-color: #292929"> </span><span style="background-color: #363636"> </span><span style="background-color: #474747"> </span><span style="background-color: #575757"> </span><span style="background-color: #606060"> </span><span style="background-color: #616161"> </span><span style="background-color: #575757"> </span><span style="background-color: #404040"> </span><span style="background-color: #2B2B2B"> </span>
|
||||
<span> </span><span style="background-color: #212121"> </span><span style="background-color: #858585"> </span><span style="background-color: #FCFCFC"> </span><span style="background-color: #D9D9D9"> </span><span style="background-color: #D2D2D2"> </span><span style="background-color: #DDDDDD"> </span><span style="background-color: #DCDCDC"> </span><span style="background-color: #AEAEAE"> </span><span style="background-color: #666666"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #5D5D5D"> </span><span style="background-color: #434343"> </span><span style="background-color: #242424"> </span><span style="background-color: #202020"> </span><span style="background-color: #222222"> </span><span style="background-color: #292929"> </span><span style="background-color: #363636"> </span><span style="background-color: #3E3E3E"> </span><span style="background-color: #363636"> </span><span style="background-color: #2B2B2B"> </span><span style="background-color: #282828"> </span>
|
||||
<span> </span><span style="background-color: #222222"> </span><span style="background-color: #9B9B9B"> </span><span style="background-color: #EAEAEA"> </span><span style="background-color: #D0D0D0"> </span><span style="background-color: #DDDDDD"> </span><span style="background-color: #C3C3C3"> </span><span style="background-color: #707070"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #5D5D5D"> </span><span style="background-color: #434343"> </span><span style="background-color: #242424"> </span><span style="background-color: #202020"> </span><span style="background-color: #212121"> </span><span style="background-color: #242424"> </span><span style="background-color: #272727"> </span><span style="background-color: #2C2C2C"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #292929"> </span><span style="background-color: #ACACAC"> </span><span style="background-color: #DDDDDD"> </span><span style="background-color: #DCDCDC"> </span><span style="background-color: #DDDDDD"> </span><span style="background-color: #D1D1D1"> </span><span style="background-color: #818181"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #5D5D5D"> </span><span style="background-color: #434343"> </span><span style="background-color: #242424"> </span><span style="background-color: #202020"> </span><span style="background-color: #212121"> </span><span style="background-color: #222222"> </span><span style="background-color: #232323"> </span><span style="background-color: #242424"> </span><span style="background-color: #262626"> </span><span style="background-color: #2E2E2E"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #2D2D2D"> </span><span style="background-color: #A6A6A6"> </span><span style="background-color: #DDDDDD"> </span><span style="background-color: #D9D9D9"> </span><span style="background-color: #989898"> </span><span style="background-color: #616161"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #5D5D5D"> </span><span style="background-color: #3E3E3E"> </span><span style="background-color: #222222"> </span><span style="background-color: #242424"> </span><span style="background-color: #262626"> </span><span style="background-color: #2B2B2B"> </span><span style="background-color: #363636"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #212121"> </span><span style="background-color: #575757"> </span><span style="background-color: #BEBEBE"> </span><span style="background-color: #DDDDDD"> </span><span style="background-color: #DCDCDC"> </span><span style="background-color: #AFAFAF"> </span><span style="background-color: #666666"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #5B5B5B"> </span><span style="background-color: #373737"> </span><span style="background-color: #222222"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #171717"> </span><span style="background-color: #212121"> </span><span style="background-color: #585858"> </span><span style="background-color: #BEBEBE"> </span><span style="background-color: #C3C3C3"> </span><span style="background-color: #717171"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #5E5E5E"> </span><span style="background-color: #424242"> </span><span style="background-color: #252525"> </span><span style="background-color: #242424"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #171717"> </span><span style="background-color: #212121"> </span><span style="background-color: #545454"> </span><span style="background-color: #717171"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #4D4D4D"> </span><span style="background-color: #292929"> </span><span style="background-color: #232323"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #171717"> </span><span style="background-color: #1F1F1F"> </span><span style="background-color: #343434"> </span><span style="background-color: #565656"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #565656"> </span><span style="background-color: #303030"> </span><span style="background-color: #222222"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #171717"> </span><span style="background-color: #1F1F1F"> </span><span style="background-color: #343434"> </span><span style="background-color: #565656"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #5C5C5C"> </span><span style="background-color: #393939"> </span><span style="background-color: #232323"> </span><span style="background-color: #252525"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #171717"> </span><span style="background-color: #1F1F1F"> </span><span style="background-color: #343434"> </span><span style="background-color: #565656"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #5E5E5E"> </span><span style="background-color: #444444"> </span><span style="background-color: #252525"> </span><span style="background-color: #222222"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #171717"> </span><span style="background-color: #1F1F1F"> </span><span style="background-color: #343434"> </span><span style="background-color: #565656"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #4F4F4F"> </span><span style="background-color: #2A2A2A"> </span><span style="background-color: #222222"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #171717"> </span><span style="background-color: #1F1F1F"> </span><span style="background-color: #343434"> </span><span style="background-color: #565656"> </span><span style="background-color: #5F5F5F"> </span><span style="background-color: #575757"> </span><span style="background-color: #323232"> </span><span style="background-color: #222222"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #171717"> </span><span style="background-color: #1F1F1F"> </span><span style="background-color: #343434"> </span><span style="background-color: #565656"> </span><span style="background-color: #5C5C5C"> </span><span style="background-color: #3C3C3C"> </span><span style="background-color: #232323"> </span><span style="background-color: #252525"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #171717"> </span><span style="background-color: #1F1F1F"> </span><span style="background-color: #343434"> </span><span style="background-color: #404040"> </span><span style="background-color: #262626"> </span><span style="background-color: #232323"> </span><span> </span>
|
||||
<span> </span><span style="background-color: #171717"> </span><span style="background-color: #1E1E1E"> </span><span style="background-color: #222222"> </span><span> </span>
|
||||
</pre>
|
||||
52
docs/input/widgets/canvas.md
Normal file
52
docs/input/widgets/canvas.md
Normal file
@@ -0,0 +1,52 @@
|
||||
Title: Canvas
|
||||
Order: 4
|
||||
---
|
||||
|
||||
`Canvas` is a widget that allows you to render arbitrary "pixels"
|
||||
(or _coxels_, as [Simon Cropp](https://twitter.com/SimonCropp/status/1331554791726534657?s=20)
|
||||
suggested we should call them).
|
||||
|
||||
# Drawing primitives
|
||||
|
||||
```csharp
|
||||
// Create a canvas
|
||||
var canvas = new Canvas(16, 16);
|
||||
|
||||
// Draw some shapes
|
||||
for(var i = 0; i < canvas.Width; i++)
|
||||
{
|
||||
// Cross
|
||||
canvas.SetPixel(i, i, Color.White);
|
||||
canvas.SetPixel(canvas.Width - i - 1, i, Color.White);
|
||||
|
||||
// Border
|
||||
canvas.SetPixel(i, 0, Color.Red);
|
||||
canvas.SetPixel(0, i, Color.Green);
|
||||
canvas.SetPixel(i, canvas.Height - 1, Color.Blue);
|
||||
canvas.SetPixel(canvas.Width - 1, i, Color.Yellow);
|
||||
}
|
||||
|
||||
// Render the canvas
|
||||
AnsiConsole.Render(canvas);
|
||||
```
|
||||
|
||||
## Result
|
||||
|
||||
<pre style="font-size:100%;font-family:consolas,'Courier New',monospace;line-height: normal; padding: 0px;background-color: #222222; padding: 20px;">
|
||||
<span style="background-color: #008000"> </span><span style="background-color: #FF0000"> </span>
|
||||
<span style="background-color: #008000"> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #800080"> </span><span style="background-color: #FFFF00"> </span>
|
||||
<span style="background-color: #008000"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #FFFF00"> </span>
|
||||
<span style="background-color: #008000"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #FFFF00"> </span>
|
||||
<span style="background-color: #008000"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #FFFF00"> </span>
|
||||
<span style="background-color: #008000"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #FFFF00"> </span>
|
||||
<span style="background-color: #008000"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #FFFF00"> </span>
|
||||
<span style="background-color: #008000"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #FFFF00"> </span>
|
||||
<span style="background-color: #008000"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #FFFF00"> </span>
|
||||
<span style="background-color: #008000"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #FFFF00"> </span>
|
||||
<span style="background-color: #008000"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #FFFF00"> </span>
|
||||
<span style="background-color: #008000"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #FFFF00"> </span>
|
||||
<span style="background-color: #008000"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #FFFF00"> </span>
|
||||
<span style="background-color: #008000"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #FFFF00"> </span>
|
||||
<span style="background-color: #008000"> </span><span style="background-color: #800080"> </span><span> </span><span style="background-color: #800080"> </span><span style="background-color: #FFFF00"> </span>
|
||||
<span style="background-color: #008000"> </span><span style="background-color: #0000FF"> </span><span style="background-color: #FFFF00"> </span>
|
||||
</pre>
|
||||
34
docs/input/widgets/figlet.md
Normal file
34
docs/input/widgets/figlet.md
Normal file
@@ -0,0 +1,34 @@
|
||||
Title: Figlet
|
||||
Order: 3
|
||||
RedirectFrom: figlet
|
||||
---
|
||||
|
||||
Spectre.Console can render [FIGlet](http://www.figlet.org/) text by using the `FigletText` class.
|
||||
|
||||
# Default font
|
||||
|
||||
```csharp
|
||||
AnsiConsole.Render(
|
||||
new FigletText("Hello")
|
||||
.LeftAligned()
|
||||
.Color(Color.Red));
|
||||
```
|
||||
|
||||
```text
|
||||
_ _ _ _
|
||||
| | | | ___ | | | | ___
|
||||
| |_| | / _ \ | | | | / _ \
|
||||
| _ | | __/ | | | | | (_) |
|
||||
|_| |_| \___| |_| |_| \___/
|
||||
```
|
||||
|
||||
# Custom font
|
||||
|
||||
```csharp
|
||||
var font = FigletFont.Load("starwars.flf");
|
||||
|
||||
AnsiConsole.Render(
|
||||
new FigletText(font, "Hello")
|
||||
.LeftAligned()
|
||||
.Color(Color.Red));
|
||||
```
|
||||
12
docs/input/widgets/index.cshtml
Normal file
12
docs/input/widgets/index.cshtml
Normal file
@@ -0,0 +1,12 @@
|
||||
Title: Widgets
|
||||
Order: 9
|
||||
---
|
||||
|
||||
<h1>Sections</h1>
|
||||
|
||||
<ul>
|
||||
@foreach (IDocument child in OutputPages.GetChildrenOf(Document))
|
||||
{
|
||||
<li>@Html.DocumentLink(child)</li>
|
||||
}
|
||||
</ul>
|
||||
@@ -1,3 +0,0 @@
|
||||
Title: Widgets
|
||||
Order: 9
|
||||
---
|
||||
@@ -1,11 +1,11 @@
|
||||
Title: Rule
|
||||
Order: 5
|
||||
Title: Rule
|
||||
Order: 1
|
||||
RedirectFrom: rule
|
||||
---
|
||||
|
||||
The `Rule` class is used to render a horizontal rule (line) to the terminal.
|
||||
|
||||

|
||||
<img src="../assets/images/rule.png" style="width: 100%;" />
|
||||
|
||||
# Usage
|
||||
|
||||
@@ -23,8 +23,9 @@ You can set the rule title markup text.
|
||||
```csharp
|
||||
var rule = new Rule("[red]Hello[/]");
|
||||
AnsiConsole.Render(rule);
|
||||
```
|
||||
|
||||
// output
|
||||
```text
|
||||
───────────────────────────────── Hello ─────────────────────────────────
|
||||
```
|
||||
|
||||
@@ -36,36 +37,36 @@ You can set the rule's title alignment.
|
||||
var rule = new Rule("[red]Hello[/]");
|
||||
rule.Alignment = Justify.Left;
|
||||
AnsiConsole.Render(rule);
|
||||
```
|
||||
|
||||
//output
|
||||
```text
|
||||
── Hello ────────────────────────────────────────────────────────────────
|
||||
```
|
||||
|
||||
You can also specify it with a method
|
||||
You can also specify it via an extension method:
|
||||
|
||||
```csharp
|
||||
var rule = new Rule("[red]Hello[/]");
|
||||
rule.LeftAligned();
|
||||
AnsiConsole.Render(rule);
|
||||
```
|
||||
|
||||
//output
|
||||
```text
|
||||
── Hello ────────────────────────────────────────────────────────────────
|
||||
```
|
||||
|
||||
|
||||
## Style
|
||||
|
||||
You can set the rule style.
|
||||
## Styling
|
||||
|
||||
```csharp
|
||||
var rule = new Rule("[red]Hello[/]");
|
||||
rule.Style = Style.Parse("red dim");
|
||||
AnsiConsole.Render(rule);
|
||||
```
|
||||
You can also specify it with a method
|
||||
You can also specify it via an extension method
|
||||
|
||||
```csharp
|
||||
var rule = new Rule("[red]Hello[/]");
|
||||
rule.SetStyle("red dim");
|
||||
rule.RuleStyle("red dim");
|
||||
AnsiConsole.Render(rule);
|
||||
```
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Title: Table
|
||||
Order: 3
|
||||
Order: 0
|
||||
RedirectFrom: tables
|
||||
---
|
||||
|
||||
@@ -51,10 +51,10 @@ For a list of borders, see the [Borders](xref:borders) appendix section.
|
||||
|
||||
```csharp
|
||||
// Sets the border
|
||||
table.SetBorder(Border.None);
|
||||
table.SetBorder(Border.Ascii);
|
||||
table.SetBorder(Border.Square);
|
||||
table.SetBorder(Border.Rounded);
|
||||
table.Border(TableBorder.None);
|
||||
table.Border(TableBorder.Ascii);
|
||||
table.Border(TableBorder.Square);
|
||||
table.Border(TableBorder.Rounded);
|
||||
```
|
||||
|
||||
## Expand / Collapse
|
||||
@@ -79,7 +79,16 @@ table.HideHeaders();
|
||||
|
||||
```csharp
|
||||
// Sets the table width to 50 cells
|
||||
table.SetWidth(50);
|
||||
table.Width(50);
|
||||
```
|
||||
|
||||
## Alignment
|
||||
|
||||
```csharp
|
||||
table.Alignment(Justify.Right);
|
||||
table.RightAligned();
|
||||
table.Centered();
|
||||
table.LeftAligned();
|
||||
```
|
||||
|
||||
# Column appearance
|
||||
@@ -91,31 +100,37 @@ table.SetWidth(50);
|
||||
## Alignment
|
||||
|
||||
```csharp
|
||||
// Set the alignment explicitly
|
||||
column.SetAlignment(Justify.Right);
|
||||
table.Columns[0].Alignment(Justify.Right);
|
||||
table.Columns[0].LeftAligned();
|
||||
table.Columns[0].Centered();
|
||||
table.Columns[0].RightAligned();
|
||||
```
|
||||
|
||||
## Padding
|
||||
|
||||
```csharp
|
||||
// Set left and right padding
|
||||
column.SetPadding(left: 3, right: 5);
|
||||
// Set padding individually
|
||||
table.Columns[0].PadLeft(3);
|
||||
table.Columns[0].PadRight(5);
|
||||
|
||||
// Set padding individually.
|
||||
column.PadLeft(3);
|
||||
column.PadRight(5);
|
||||
// Or chained together
|
||||
table.Columns[0].PadLeft(3).PadRight(5);
|
||||
|
||||
// Or with the shorthand method if the left and right
|
||||
// padding are identical. Vertical padding is ignored.
|
||||
table.Columns[0].Padding(4, 0);
|
||||
```
|
||||
|
||||
## Disable column wrapping
|
||||
|
||||
```csharp
|
||||
// Disable column wrapping
|
||||
column.NoWrap();
|
||||
table.Columns[0].NoWrap();
|
||||
```
|
||||
|
||||
## Set column width
|
||||
|
||||
```csharp
|
||||
// Set the column width (no fluent extension method for this yet)
|
||||
column.Width = 15;
|
||||
// Set the column width
|
||||
table.Columns[0].Width(15);
|
||||
```
|
||||
@@ -3,7 +3,7 @@
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"cake.tool": {
|
||||
"version": "0.38.4",
|
||||
"version": "1.0.0-rc0001",
|
||||
"commands": [
|
||||
"dotnet-cake"
|
||||
]
|
||||
@@ -15,7 +15,7 @@
|
||||
]
|
||||
},
|
||||
"dotnet-example": {
|
||||
"version": "0.8.0",
|
||||
"version": "1.1.0",
|
||||
"commands": [
|
||||
"dotnet-example"
|
||||
]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Borders</Title>
|
||||
<Description>Demonstrates the different kind of borders.</Description>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Diagnostics;
|
||||
using Spectre.Console;
|
||||
using Spectre.Console.Rendering;
|
||||
|
||||
@@ -22,7 +21,7 @@ namespace BordersExample
|
||||
static IRenderable CreatePanel(string name, BoxBorder border)
|
||||
{
|
||||
return new Panel($"This is a panel with\nthe [yellow]{name}[/] border.")
|
||||
.Header($" {name} ", Style.Parse("blue"), Justify.Center)
|
||||
.Header($" [blue]{name}[/] ", Justify.Center)
|
||||
.Border(border)
|
||||
.BorderStyle(Style.Parse("grey"));
|
||||
}
|
||||
@@ -54,7 +53,7 @@ namespace BordersExample
|
||||
table.AddRow("Cell", "Cell");
|
||||
|
||||
return new Panel(table)
|
||||
.Header($" {name} ", Style.Parse("blue"), Justify.Center)
|
||||
.Header($" [blue]{name}[/] ", Justify.Center)
|
||||
.NoBorder();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Calendars</Title>
|
||||
<Description>Demonstrates how to render calendars.</Description>
|
||||
|
||||
22
examples/Canvas/Canvas.csproj
Normal file
22
examples/Canvas/Canvas.csproj
Normal file
@@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Canvas</Title>
|
||||
<Description>Demonstrates how to render pixels and images.</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Spectre.Console.ImageSharp\Spectre.Console.ImageSharp.csproj" />
|
||||
<ProjectReference Include="..\..\src\Spectre.Console\Spectre.Console.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="cake.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
87
examples/Canvas/Mandelbrot.cs
Normal file
87
examples/Canvas/Mandelbrot.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
Ported from: https://rosettacode.org/wiki/Mandelbrot_set#C.23
|
||||
Licensed under GNU Free Documentation License 1.2
|
||||
*/
|
||||
|
||||
using System;
|
||||
using Spectre.Console;
|
||||
|
||||
namespace CanvasExample
|
||||
{
|
||||
public static class Mandelbrot
|
||||
{
|
||||
private const double MaxValueExtent = 2.0;
|
||||
|
||||
private struct ComplexNumber
|
||||
{
|
||||
public double Real { get; }
|
||||
public double Imaginary { get; }
|
||||
|
||||
public ComplexNumber(double real, double imaginary)
|
||||
{
|
||||
Real = real;
|
||||
Imaginary = imaginary;
|
||||
}
|
||||
|
||||
public static ComplexNumber operator +(ComplexNumber x, ComplexNumber y)
|
||||
{
|
||||
return new ComplexNumber(x.Real + y.Real, x.Imaginary + y.Imaginary);
|
||||
}
|
||||
|
||||
public static ComplexNumber operator *(ComplexNumber x, ComplexNumber y)
|
||||
{
|
||||
return new ComplexNumber(x.Real * y.Real - x.Imaginary * y.Imaginary,
|
||||
x.Real * y.Imaginary + x.Imaginary * y.Real);
|
||||
}
|
||||
|
||||
public double Abs()
|
||||
{
|
||||
return Real * Real + Imaginary * Imaginary;
|
||||
}
|
||||
}
|
||||
|
||||
public static Canvas Generate(int width, int height)
|
||||
{
|
||||
var canvas = new Canvas(width, height);
|
||||
|
||||
var scale = 2 * MaxValueExtent / Math.Min(canvas.Width, canvas.Height);
|
||||
for (var i = 0; i < canvas.Height; i++)
|
||||
{
|
||||
var y = (canvas.Height / 2 - i) * scale;
|
||||
for (var j = 0; j < canvas.Width; j++)
|
||||
{
|
||||
var x = (j - canvas.Width / 2) * scale;
|
||||
var value = Calculate(new ComplexNumber(x, y));
|
||||
canvas.SetPixel(j, i, GetColor(value));
|
||||
}
|
||||
}
|
||||
|
||||
return canvas;
|
||||
}
|
||||
|
||||
private static double Calculate(ComplexNumber c)
|
||||
{
|
||||
const int MaxIterations = 1000;
|
||||
const double MaxNorm = MaxValueExtent * MaxValueExtent;
|
||||
|
||||
var iteration = 0;
|
||||
var z = new ComplexNumber();
|
||||
do
|
||||
{
|
||||
z = z * z + c;
|
||||
iteration++;
|
||||
} while (z.Abs() < MaxNorm && iteration < MaxIterations);
|
||||
|
||||
return iteration < MaxIterations
|
||||
? (double)iteration / MaxIterations
|
||||
: 0;
|
||||
}
|
||||
|
||||
private static Color GetColor(double value)
|
||||
{
|
||||
const double MaxColor = 256;
|
||||
const double ContrastValue = 0.2;
|
||||
return new Color(0, 0, (byte)(MaxColor * Math.Pow(value, ContrastValue)));
|
||||
}
|
||||
}
|
||||
}
|
||||
36
examples/Canvas/Program.cs
Normal file
36
examples/Canvas/Program.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using Spectre.Console;
|
||||
using Spectre.Console.Rendering;
|
||||
|
||||
namespace CanvasExample
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
// Draw a mandelbrot set using a Canvas
|
||||
var mandelbrot = Mandelbrot.Generate(32, 32);
|
||||
Render(mandelbrot, "Mandelbrot");
|
||||
|
||||
// Draw an image using CanvasImage powered by ImageSharp.
|
||||
// This requires the "Spectre.Console.ImageSharp" NuGet package.
|
||||
var image = new CanvasImage("cake.png");
|
||||
image.BilinearResampler();
|
||||
image.MaxWidth(16);
|
||||
Render(image, "Image from file (16 wide)");
|
||||
|
||||
// Draw image again, but without render width
|
||||
image.NoMaxWidth();
|
||||
image.Mutate(ctx => ctx.Grayscale().Rotate(-45).EntropyCrop());
|
||||
Render(image, "Image from file (fit, greyscale, rotated)");
|
||||
}
|
||||
|
||||
private static void Render(IRenderable canvas, string title)
|
||||
{
|
||||
AnsiConsole.WriteLine();
|
||||
AnsiConsole.Render(new Rule($"[yellow]{title}[/]").LeftAligned().RuleStyle("grey"));
|
||||
AnsiConsole.WriteLine();
|
||||
AnsiConsole.Render(canvas);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
examples/Canvas/cake.png
Normal file
BIN
examples/Canvas/cake.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Colors</Title>
|
||||
<Description>Demonstrates how to use [yellow]c[/][red]o[/][green]l[/][blue]o[/][aqua]r[/][lime]s[/] in the console.</Description>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Columns</Title>
|
||||
<Description>Demonstrates how to render data into columns.</Description>
|
||||
|
||||
15
examples/Cursor/Cursor.csproj
Normal file
15
examples/Cursor/Cursor.csproj
Normal file
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Cursor</Title>
|
||||
<Description>Demonstrates how to move the cursor.</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Spectre.Console\Spectre.Console.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
20
examples/Cursor/Program.cs
Normal file
20
examples/Cursor/Program.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Spectre.Console;
|
||||
|
||||
namespace Cursor
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
AnsiConsole.Write("Hello");
|
||||
|
||||
// Move the cursor 3 cells to the right
|
||||
AnsiConsole.Cursor.Move(CursorDirection.Right, 3);
|
||||
AnsiConsole.Write("World");
|
||||
|
||||
// Move the cursor 5 cells to the left.
|
||||
AnsiConsole.Cursor.Move(CursorDirection.Left, 5);
|
||||
AnsiConsole.WriteLine("Universe");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Emojis</Title>
|
||||
<Description>Demonstrates how to render emojis.</Description>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Exceptions</Title>
|
||||
<Description>Demonstrates how to render formatted exceptions.</Description>
|
||||
|
||||
15
examples/Figlet/Figlet.csproj
Normal file
15
examples/Figlet/Figlet.csproj
Normal file
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Figlet</Title>
|
||||
<Description>Demonstrates how to render FIGlet text.</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Spectre.Console\Spectre.Console.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
14
examples/Figlet/Program.cs
Normal file
14
examples/Figlet/Program.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Spectre.Console;
|
||||
|
||||
namespace EmojiExample
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
AnsiConsole.Render(new FigletText("Left aligned").LeftAligned().Color(Color.Red));
|
||||
AnsiConsole.Render(new FigletText("Centered").Centered().Color(Color.Green));
|
||||
AnsiConsole.Render(new FigletText("Right aligned").RightAligned().Color(Color.Blue));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Grids</Title>
|
||||
<Description>Demonstrates how to render grids in a console.</Description>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Info</Title>
|
||||
<Description>Displays the capabilities of the current console.</Description>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using Spectre.Console;
|
||||
|
||||
namespace InfoExample
|
||||
@@ -12,6 +13,7 @@ namespace InfoExample
|
||||
.AddRow("[b]Color system[/]", $"{AnsiConsole.Capabilities.ColorSystem}")
|
||||
.AddRow("[b]Supports ansi?[/]", $"{YesNo(AnsiConsole.Capabilities.SupportsAnsi)}")
|
||||
.AddRow("[b]Legacy console?[/]", $"{YesNo(AnsiConsole.Capabilities.LegacyConsole)}")
|
||||
.AddRow("[b]Interactive?[/]", $"{YesNo(Environment.UserInteractive)}")
|
||||
.AddRow("[b]Buffer width[/]", $"{AnsiConsole.Console.Width}")
|
||||
.AddRow("[b]Buffer height[/]", $"{AnsiConsole.Console.Height}");
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Links</Title>
|
||||
<Description>Demonstrates how to render links in a console.</Description>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Panels</Title>
|
||||
<Description>Demonstrates how to render items in panels.</Description>
|
||||
|
||||
@@ -20,16 +20,14 @@ namespace PanelExample
|
||||
new Panel(new Text("Left adjusted\nLeft").LeftAligned())
|
||||
.Expand()
|
||||
.SquareBorder()
|
||||
.Header("Left")
|
||||
.HeaderStyle("red"));
|
||||
.Header("[red]Left[/]"));
|
||||
|
||||
// Centered ASCII panel with text
|
||||
AnsiConsole.Render(
|
||||
new Panel(new Text("Centered\nCenter").Centered())
|
||||
.Expand()
|
||||
.AsciiBorder()
|
||||
.Header("Center")
|
||||
.HeaderStyle("green")
|
||||
.Header("[green]Center[/]")
|
||||
.HeaderAlignment(Justify.Center));
|
||||
|
||||
// Right adjusted, rounded panel with text
|
||||
@@ -37,8 +35,7 @@ namespace PanelExample
|
||||
new Panel(new Text("Right adjusted\nRight").RightAligned())
|
||||
.Expand()
|
||||
.RoundedBorder()
|
||||
.Header("Right")
|
||||
.HeaderStyle("blue")
|
||||
.Header("[blue]Right[/]")
|
||||
.HeaderAlignment(Justify.Right));
|
||||
}
|
||||
}
|
||||
|
||||
77
examples/Prompt/Program.cs
Normal file
77
examples/Prompt/Program.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using Spectre.Console;
|
||||
|
||||
namespace Cursor
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
// Confirmation
|
||||
if (!AnsiConsole.Confirm("Run prompt example?"))
|
||||
{
|
||||
AnsiConsole.MarkupLine("Ok... :(");
|
||||
return;
|
||||
}
|
||||
|
||||
// String
|
||||
AnsiConsole.WriteLine();
|
||||
AnsiConsole.Render(new Rule("[yellow]Strings[/]").RuleStyle("grey").LeftAligned());
|
||||
var name = AnsiConsole.Ask<string>("What's your [green]name[/]?");
|
||||
|
||||
// String with choices
|
||||
AnsiConsole.WriteLine();
|
||||
AnsiConsole.Render(new Rule("[yellow]Choices[/]").RuleStyle("grey").LeftAligned());
|
||||
var fruit = AnsiConsole.Prompt(
|
||||
new TextPrompt<string>("What's your [green]favorite fruit[/]?")
|
||||
.InvalidChoiceMessage("[red]That's not a valid fruit[/]")
|
||||
.DefaultValue("Orange")
|
||||
.AddChoice("Apple")
|
||||
.AddChoice("Banana")
|
||||
.AddChoice("Orange"));
|
||||
|
||||
// Integer
|
||||
AnsiConsole.WriteLine();
|
||||
AnsiConsole.Render(new Rule("[yellow]Integers[/]").RuleStyle("grey").LeftAligned());
|
||||
var age = AnsiConsole.Prompt(
|
||||
new TextPrompt<int>("How [green]old[/] are you?")
|
||||
.PromptStyle("green")
|
||||
.ValidationErrorMessage("[red]That's not a valid age[/]")
|
||||
.Validate(age =>
|
||||
{
|
||||
return age switch
|
||||
{
|
||||
<= 0 => ValidationResult.Error("[red]You must at least be 1 years old[/]"),
|
||||
>= 123 => ValidationResult.Error("[red]You must be younger than the oldest person alive[/]"),
|
||||
_ => ValidationResult.Success(),
|
||||
};
|
||||
}));
|
||||
|
||||
// Secret
|
||||
AnsiConsole.WriteLine();
|
||||
AnsiConsole.Render(new Rule("[yellow]Secrets[/]").RuleStyle("grey").LeftAligned());
|
||||
var password = AnsiConsole.Prompt(
|
||||
new TextPrompt<string>("Enter [green]password[/]?")
|
||||
.PromptStyle("red")
|
||||
.Secret());
|
||||
|
||||
// Optional
|
||||
AnsiConsole.WriteLine();
|
||||
AnsiConsole.Render(new Rule("[yellow]Optional[/]").RuleStyle("grey").LeftAligned());
|
||||
var color = AnsiConsole.Prompt(
|
||||
new TextPrompt<string>("[grey][[Optional]][/] What is your [green]favorite color[/]?")
|
||||
.AllowEmpty());
|
||||
|
||||
// Summary
|
||||
AnsiConsole.WriteLine();
|
||||
AnsiConsole.Render(new Rule("[yellow]Results[/]").RuleStyle("grey").LeftAligned());
|
||||
AnsiConsole.Render(new Table().AddColumns("[grey]Question[/]", "[grey]Answer[/]")
|
||||
.RoundedBorder()
|
||||
.BorderColor(Color.Grey)
|
||||
.AddRow("[grey]Name[/]", name)
|
||||
.AddRow("[grey]Favorite fruit[/]", fruit)
|
||||
.AddRow("[grey]Age[/]", age.ToString())
|
||||
.AddRow("[grey]Password[/]", password)
|
||||
.AddRow("[grey]Favorite color[/]", string.IsNullOrEmpty(color) ? "Unknown" : color));
|
||||
}
|
||||
}
|
||||
}
|
||||
16
examples/Prompt/Prompt.csproj
Normal file
16
examples/Prompt/Prompt.csproj
Normal file
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<LangVersion>9</LangVersion>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Prompt</Title>
|
||||
<Description>Demonstrates how to get input from a user.</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Spectre.Console\Spectre.Console.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -7,33 +7,36 @@ namespace EmojiExample
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
// No title
|
||||
WrapInPanel(
|
||||
Render(
|
||||
new Rule()
|
||||
.RuleStyle(Style.Parse("yellow"))
|
||||
.AsciiBorder()
|
||||
.LeftAligned());
|
||||
|
||||
// Left aligned title
|
||||
WrapInPanel(
|
||||
new Rule("[white]Left aligned[/]")
|
||||
Render(
|
||||
new Rule("[blue]Left aligned[/]")
|
||||
.RuleStyle(Style.Parse("red"))
|
||||
.DoubleBorder()
|
||||
.LeftAligned());
|
||||
|
||||
// Centered title
|
||||
WrapInPanel(
|
||||
new Rule("[silver]Centered[/]")
|
||||
Render(
|
||||
new Rule("[green]Centered[/]")
|
||||
.RuleStyle(Style.Parse("green"))
|
||||
.HeavyBorder()
|
||||
.Centered());
|
||||
|
||||
// Right aligned title
|
||||
WrapInPanel(
|
||||
new Rule("[grey]Right aligned[/]")
|
||||
Render(
|
||||
new Rule("[red]Right aligned[/]")
|
||||
.RuleStyle(Style.Parse("blue"))
|
||||
.RightAligned());
|
||||
}
|
||||
|
||||
private static void WrapInPanel(Rule rule)
|
||||
private static void Render(Rule rule)
|
||||
{
|
||||
AnsiConsole.Render(new Panel(rule).Expand().BorderStyle(Style.Parse("grey")));
|
||||
AnsiConsole.Render(rule);
|
||||
AnsiConsole.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Rules</Title>
|
||||
<Description>Demonstrates how to render horizontal rules (lines).</Description>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<Title>Tables</Title>
|
||||
<Description>Demonstrates how to render tables in a console.</Description>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"projects": [ "src" ],
|
||||
"sdk": {
|
||||
"version": "3.1.301",
|
||||
"version": "5.0.100",
|
||||
"rollForward": "latestPatch"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project>
|
||||
<PropertyGroup Label="Settings">
|
||||
<Deterministic>true</Deterministic>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>embedded</DebugType>
|
||||
<MinVerSkip Condition="'$(Configuration)' == 'Debug'">true</MinVerSkip>
|
||||
|
||||
125
src/Spectre.Console.ImageSharp/CanvasImage.cs
Normal file
125
src/Spectre.Console.ImageSharp/CanvasImage.cs
Normal file
@@ -0,0 +1,125 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using SixLabors.ImageSharp.Processing.Processors.Transforms;
|
||||
using Spectre.Console.Rendering;
|
||||
|
||||
namespace Spectre.Console
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a renderable image.
|
||||
/// </summary>
|
||||
public sealed class CanvasImage : Renderable
|
||||
{
|
||||
private static readonly IResampler _defaultResampler = KnownResamplers.Bicubic;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the image width.
|
||||
/// </summary>
|
||||
public int Width => Image.Width;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the image height.
|
||||
/// </summary>
|
||||
public int Height => Image.Height;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the render width of the canvas.
|
||||
/// </summary>
|
||||
public int? MaxWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the render width of the canvas.
|
||||
/// </summary>
|
||||
public int PixelWidth { get; set; } = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the <see cref="IResampler"/> that should
|
||||
/// be used when scaling the image. Defaults to bicubic sampling.
|
||||
/// </summary>
|
||||
public IResampler? Resampler { get; set; }
|
||||
|
||||
internal SixLabors.ImageSharp.Image<Rgba32> Image { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CanvasImage"/> class.
|
||||
/// </summary>
|
||||
/// <param name="filename">The image filename.</param>
|
||||
public CanvasImage(string filename)
|
||||
{
|
||||
Image = SixLabors.ImageSharp.Image.Load<Rgba32>(filename);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override Measurement Measure(RenderContext context, int maxWidth)
|
||||
{
|
||||
if (PixelWidth < 0)
|
||||
{
|
||||
throw new InvalidOperationException("Pixel width must be greater than zero.");
|
||||
}
|
||||
|
||||
var width = MaxWidth ?? Width;
|
||||
if (maxWidth < width * PixelWidth)
|
||||
{
|
||||
return new Measurement(maxWidth, maxWidth);
|
||||
}
|
||||
|
||||
return new Measurement(width * PixelWidth, width * PixelWidth);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override IEnumerable<Segment> Render(RenderContext context, int maxWidth)
|
||||
{
|
||||
var image = Image;
|
||||
|
||||
var width = Width;
|
||||
var height = Height;
|
||||
|
||||
// Got a max width?
|
||||
if (MaxWidth != null)
|
||||
{
|
||||
height = (int)(height * ((float)MaxWidth.Value) / Width);
|
||||
width = MaxWidth.Value;
|
||||
}
|
||||
|
||||
// Exceed the max width when we take pixel width into account?
|
||||
if (width * PixelWidth > maxWidth)
|
||||
{
|
||||
height = (int)(height * (maxWidth / (float)(width * PixelWidth)));
|
||||
width = maxWidth / PixelWidth;
|
||||
}
|
||||
|
||||
// Need to rescale the pixel buffer?
|
||||
if (width != Width || height != Height)
|
||||
{
|
||||
var resampler = Resampler ?? _defaultResampler;
|
||||
image = image.Clone(); // Clone the original image
|
||||
image.Mutate(i => i.Resize(width, height, resampler));
|
||||
}
|
||||
|
||||
var canvas = new Canvas(width, height)
|
||||
{
|
||||
MaxWidth = MaxWidth,
|
||||
PixelWidth = PixelWidth,
|
||||
Scale = false,
|
||||
};
|
||||
|
||||
for (var y = 0; y < image.Height; y++)
|
||||
{
|
||||
for (var x = 0; x < image.Width; x++)
|
||||
{
|
||||
if (image[x, y].A == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
canvas.SetPixel(x, y, new Color(
|
||||
image[x, y].R, image[x, y].G, image[x, y].B));
|
||||
}
|
||||
}
|
||||
|
||||
return ((IRenderable)canvas).Render(context, maxWidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
135
src/Spectre.Console.ImageSharp/CanvasImageExtensions.cs
Normal file
135
src/Spectre.Console.ImageSharp/CanvasImageExtensions.cs
Normal file
@@ -0,0 +1,135 @@
|
||||
using System;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
|
||||
namespace Spectre.Console
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains extension methods for <see cref="CanvasImage"/>.
|
||||
/// </summary>
|
||||
public static class CanvasImageExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets the maximum width of the rendered image.
|
||||
/// </summary>
|
||||
/// <param name="image">The canvas image.</param>
|
||||
/// <param name="maxWidth">The maximum width.</param>
|
||||
/// <returns>The same instance so that multiple calls can be chained.</returns>
|
||||
public static CanvasImage MaxWidth(this CanvasImage image, int? maxWidth)
|
||||
{
|
||||
if (image is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(image));
|
||||
}
|
||||
|
||||
image.MaxWidth = maxWidth;
|
||||
return image;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disables the maximum width of the rendered image.
|
||||
/// </summary>
|
||||
/// <param name="image">The canvas image.</param>
|
||||
/// <returns>The same instance so that multiple calls can be chained.</returns>
|
||||
public static CanvasImage NoMaxWidth(this CanvasImage image)
|
||||
{
|
||||
if (image is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(image));
|
||||
}
|
||||
|
||||
image.MaxWidth = null;
|
||||
return image;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the pixel width.
|
||||
/// </summary>
|
||||
/// <param name="image">The canvas image.</param>
|
||||
/// <param name="width">The pixel width.</param>
|
||||
/// <returns>The same instance so that multiple calls can be chained.</returns>
|
||||
public static CanvasImage PixelWidth(this CanvasImage image, int width)
|
||||
{
|
||||
if (image is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(image));
|
||||
}
|
||||
|
||||
image.PixelWidth = width;
|
||||
return image;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mutates the underlying image.
|
||||
/// </summary>
|
||||
/// <param name="image">The canvas image.</param>
|
||||
/// <param name="action">The action that mutates the underlying image.</param>
|
||||
/// <returns>The same instance so that multiple calls can be chained.</returns>
|
||||
public static CanvasImage Mutate(this CanvasImage image, Action<IImageProcessingContext> action)
|
||||
{
|
||||
if (image is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(image));
|
||||
}
|
||||
|
||||
if (action is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(action));
|
||||
}
|
||||
|
||||
image.Image.Mutate(action);
|
||||
return image;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Uses a bicubic sampler that implements the bicubic kernel algorithm W(x).
|
||||
/// </summary>
|
||||
/// <param name="image">The canvas image.</param>
|
||||
/// <returns>The same instance so that multiple calls can be chained.</returns>
|
||||
public static CanvasImage BicubicResampler(this CanvasImage image)
|
||||
{
|
||||
if (image is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(image));
|
||||
}
|
||||
|
||||
image.Resampler = KnownResamplers.Bicubic;
|
||||
return image;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Uses a bilinear sampler. This interpolation algorithm
|
||||
/// can be used where perfect image transformation with pixel matching is impossible,
|
||||
/// so that one can calculate and assign appropriate intensity values to pixels.
|
||||
/// </summary>
|
||||
/// <param name="image">The canvas image.</param>
|
||||
/// <returns>The same instance so that multiple calls can be chained.</returns>
|
||||
public static CanvasImage BilinearResampler(this CanvasImage image)
|
||||
{
|
||||
if (image is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(image));
|
||||
}
|
||||
|
||||
image.Resampler = KnownResamplers.Triangle;
|
||||
return image;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Uses a Nearest-Neighbour sampler that implements the nearest neighbor algorithm.
|
||||
/// This uses a very fast, unscaled filter which will select the closest pixel to
|
||||
/// the new pixels position.
|
||||
/// </summary>
|
||||
/// <param name="image">The canvas image.</param>
|
||||
/// <returns>The same instance so that multiple calls can be chained.</returns>
|
||||
public static CanvasImage NearestNeighborResampler(this CanvasImage image)
|
||||
{
|
||||
if (image is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(image));
|
||||
}
|
||||
|
||||
image.Resampler = KnownResamplers.NearestNeighbor;
|
||||
return image;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0</TargetFrameworks>
|
||||
<Nullable>enable</Nullable>
|
||||
<Description>A library that extends Spectre.Console with ImageSharp superpowers.</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Include="..\stylecop.json" Link="Properties/stylecop.json" />
|
||||
<None Include="../../resources/gfx/small-logo.png" Pack="true" PackagePath="\" Link="Properties/small-logo.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Spectre.Console\Spectre.Console.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -8,6 +8,9 @@ namespace Spectre.Console.Tests.Data
|
||||
[SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "<Pending>")]
|
||||
public static bool MethodThatThrows(int? number) => throw new InvalidOperationException("Throwing!");
|
||||
|
||||
[SuppressMessage("Usage", "CA1801:Review unused parameters", Justification = "<Pending>")]
|
||||
public static bool GenericMethodThatThrows<T0, T1, TRet>(int? number) => throw new InvalidOperationException("Throwing!");
|
||||
|
||||
public static void ThrowWithInnerException()
|
||||
{
|
||||
try
|
||||
@@ -19,5 +22,17 @@ namespace Spectre.Console.Tests.Data
|
||||
throw new InvalidOperationException("Something threw!", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ThrowWithGenericInnerException()
|
||||
{
|
||||
try
|
||||
{
|
||||
GenericMethodThatThrows<int, float, double>(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new InvalidOperationException("Something threw!", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
719
src/Spectre.Console.Tests/Data/starwars.flf
Normal file
719
src/Spectre.Console.Tests/Data/starwars.flf
Normal file
@@ -0,0 +1,719 @@
|
||||
flf2a$ 7 6 22 15 4
|
||||
starwars.flf by Ryan Youck (youck@cs.uregina.ca) Dec 25/1994
|
||||
I am not responsible for use of this font
|
||||
Based on Big.flf by Glenn Chappell
|
||||
|
||||
$ $@
|
||||
$ $@
|
||||
$ $@
|
||||
$ $@
|
||||
$ $@
|
||||
$ $@
|
||||
$ $@@
|
||||
__ $@
|
||||
| |$@
|
||||
| |$@
|
||||
| |$@
|
||||
|__|$@
|
||||
(__)$@
|
||||
$@@
|
||||
_ _ @
|
||||
( | )@
|
||||
V V @
|
||||
$ @
|
||||
$ @
|
||||
$ @
|
||||
@@
|
||||
_ _ @
|
||||
_| || |_$@
|
||||
|_ __ _|@
|
||||
_| || |_ @
|
||||
|_ __ _|@
|
||||
|_||_| $@
|
||||
@@
|
||||
__,--,_.@
|
||||
/ |@
|
||||
| (----`@
|
||||
\ \ $@
|
||||
.----) | $@
|
||||
|_ __/ $@
|
||||
'--' $@@
|
||||
_ ___$ @
|
||||
/ \ / /$ @
|
||||
( o ) / / $ @
|
||||
\_/ / / _$ @
|
||||
/ / / \ @
|
||||
/ / ( o )@
|
||||
/__/ \_/ @@
|
||||
@
|
||||
___ @
|
||||
( _ ) $@
|
||||
/ _ \/\@
|
||||
| (_> <@
|
||||
\___/\/@
|
||||
$@@
|
||||
__ @
|
||||
(_ )@
|
||||
|/ @
|
||||
$ @
|
||||
$ @
|
||||
$ @
|
||||
@@
|
||||
___@
|
||||
/ /@
|
||||
| |$@
|
||||
| |$@
|
||||
| |$@
|
||||
| |$@
|
||||
\__\@@
|
||||
___ @
|
||||
\ \ @
|
||||
| |@
|
||||
| |@
|
||||
| |@
|
||||
| |@
|
||||
/__/ @@
|
||||
_ @
|
||||
/\| |/\ @
|
||||
\ ` ' /$@
|
||||
|_ _|@
|
||||
/ , . \$@
|
||||
\/|_|\/ @
|
||||
@@
|
||||
@
|
||||
_ @
|
||||
_| |_$@
|
||||
|_ _|@
|
||||
|_| $@
|
||||
$ @
|
||||
@@
|
||||
@
|
||||
@
|
||||
$ @
|
||||
$ @
|
||||
__ @
|
||||
(_ )@
|
||||
|/ @@
|
||||
@
|
||||
@
|
||||
______ @
|
||||
|______|@
|
||||
$ @
|
||||
$ @
|
||||
@@
|
||||
@
|
||||
@
|
||||
@
|
||||
$ @
|
||||
__ @
|
||||
(__)@
|
||||
@@
|
||||
___@
|
||||
/ /@
|
||||
/ / @
|
||||
/ /$ @
|
||||
/ /$ @
|
||||
/__/$ @
|
||||
@@
|
||||
___ $@
|
||||
/ _ \ $@
|
||||
| | | |$@
|
||||
| | | |$@
|
||||
| |_| |$@
|
||||
\___/ $@
|
||||
$@@
|
||||
__ $@
|
||||
/_ |$@
|
||||
| |$@
|
||||
| |$@
|
||||
| |$@
|
||||
|_|$@
|
||||
$@@
|
||||
___ $@
|
||||
|__ \ $@
|
||||
$) |$@
|
||||
/ / $@
|
||||
/ /_ $@
|
||||
|____|$@
|
||||
$@@
|
||||
____ $@
|
||||
|___ \ $@
|
||||
__) |$@
|
||||
|__ < $@
|
||||
___) |$@
|
||||
|____/ $@
|
||||
$@@
|
||||
_ _ $@
|
||||
| || | $@
|
||||
| || |_ $@
|
||||
|__ _|$@
|
||||
| | $@
|
||||
|_| $@
|
||||
$@@
|
||||
_____ $@
|
||||
| ____|$@
|
||||
| |__ $@
|
||||
|___ \ $@
|
||||
___) |$@
|
||||
|____/ $@
|
||||
$@@
|
||||
__ $@
|
||||
/ / $@
|
||||
/ /_ $@
|
||||
| '_ \ $@
|
||||
| (_) |$@
|
||||
\___/ $@
|
||||
$@@
|
||||
______ $@
|
||||
|____ |$@
|
||||
$/ / $@
|
||||
/ / $@
|
||||
/ / $@
|
||||
/_/ $@
|
||||
$@@
|
||||
___ $@
|
||||
/ _ \ $@
|
||||
| (_) |$@
|
||||
> _ < $@
|
||||
| (_) |$@
|
||||
\___/ $@
|
||||
$@@
|
||||
___ $@
|
||||
/ _ \ $@
|
||||
| (_) |$@
|
||||
\__, |$@
|
||||
/ / $@
|
||||
/_/ $@
|
||||
$@@
|
||||
@
|
||||
_ @
|
||||
(_)@
|
||||
$ @
|
||||
_ @
|
||||
(_)@
|
||||
@@
|
||||
@
|
||||
_ @
|
||||
(_)@
|
||||
$ @
|
||||
_ @
|
||||
( )@
|
||||
|/ @@
|
||||
___@
|
||||
/ /@
|
||||
/ /$@
|
||||
< <$ @
|
||||
\ \$@
|
||||
\__\@
|
||||
@@
|
||||
@
|
||||
______ @
|
||||
|______|@
|
||||
______ @
|
||||
|______|@
|
||||
@
|
||||
@@
|
||||
___ @
|
||||
\ \$ @
|
||||
\ \ @
|
||||
> >@
|
||||
/ / @
|
||||
/__/$ @
|
||||
@@
|
||||
______ $@
|
||||
| \ $@
|
||||
`----) |$@
|
||||
/ / $@
|
||||
|__| $@
|
||||
__ $@
|
||||
(__) $@@
|
||||
____ @
|
||||
/ __ \ @
|
||||
/ / _` |@
|
||||
| | (_| |@
|
||||
\ \__,_|@
|
||||
\____/ @
|
||||
@@
|
||||
___ $ @
|
||||
/ \ $ @
|
||||
/ ^ \$ @
|
||||
/ /_\ \$ @
|
||||
/ _____ \$ @
|
||||
/__/ \__\$@
|
||||
$@@
|
||||
.______ $@
|
||||
| _ \ $@
|
||||
| |_) |$@
|
||||
| _ < $@
|
||||
| |_) |$@
|
||||
|______/ $@
|
||||
$@@
|
||||
______$@
|
||||
/ |@
|
||||
| ,----'@
|
||||
| | $@
|
||||
| `----.@
|
||||
\______|@
|
||||
$@@
|
||||
_______ $@
|
||||
| \$@
|
||||
| .--. |@
|
||||
| | | |@
|
||||
| '--' |@
|
||||
|_______/$@
|
||||
$@@
|
||||
_______ @
|
||||
| ____|@
|
||||
| |__ $@
|
||||
| __| $@
|
||||
| |____ @
|
||||
|_______|@
|
||||
@@
|
||||
_______ @
|
||||
| ____|@
|
||||
| |__ $@
|
||||
| __| $@
|
||||
| | $ @
|
||||
|__| @
|
||||
@@
|
||||
_______ @
|
||||
/ _____|@
|
||||
| | __ $@
|
||||
| | |_ |$@
|
||||
| |__| |$@
|
||||
\______|$@
|
||||
$@@
|
||||
__ __ $@
|
||||
| | | |$@
|
||||
| |__| |$@
|
||||
| __ |$@
|
||||
| | | |$@
|
||||
|__| |__|$@
|
||||
$@@
|
||||
__ $@
|
||||
| |$@
|
||||
| |$@
|
||||
| |$@
|
||||
| |$@
|
||||
|__|$@
|
||||
$@@
|
||||
__ $@
|
||||
| |$@
|
||||
| |$@
|
||||
.--. | |$@
|
||||
| `--' |$@
|
||||
\______/ $@
|
||||
$@@
|
||||
__ ___$@
|
||||
| |/ /$@
|
||||
| ' / $@
|
||||
| < $@
|
||||
| . \ $@
|
||||
|__|\__\$@
|
||||
$@@
|
||||
__ $@
|
||||
| | $@
|
||||
| | $@
|
||||
| | $@
|
||||
| `----.@
|
||||
|_______|@
|
||||
$@@
|
||||
.___ ___.$@
|
||||
| \/ |$@
|
||||
| \ / |$@
|
||||
| |\/| |$@
|
||||
| | | |$@
|
||||
|__| |__|$@
|
||||
$@@
|
||||
.__ __.$@
|
||||
| \ | |$@
|
||||
| \| |$@
|
||||
| . ` |$@
|
||||
| |\ |$@
|
||||
|__| \__|$@
|
||||
$@@
|
||||
______ $@
|
||||
/ __ \ $@
|
||||
| | | |$@
|
||||
| | | |$@
|
||||
| `--' |$@
|
||||
\______/ $@
|
||||
$@@
|
||||
.______ $@
|
||||
| _ \ $@
|
||||
| |_) |$@
|
||||
| ___/ $@
|
||||
| | $ @
|
||||
| _| $ @
|
||||
$ @@
|
||||
______ $ @
|
||||
/ __ \ $ @
|
||||
| | | | $ @
|
||||
| | | | $ @
|
||||
| `--' '--. @
|
||||
\_____\_____\@
|
||||
$ @@
|
||||
.______ $ @
|
||||
| _ \ $ @
|
||||
| |_) | $ @
|
||||
| / $ @
|
||||
| |\ \----.@
|
||||
| _| `._____|@
|
||||
$@@
|
||||
_______.@
|
||||
/ |@
|
||||
| (----`@
|
||||
\ \ $@
|
||||
.----) | $@
|
||||
|_______/ $@
|
||||
$@@
|
||||
.___________.@
|
||||
| |@
|
||||
`---| |----`@
|
||||
| | $ @
|
||||
| | $ @
|
||||
|__| $ @
|
||||
$ @@
|
||||
__ __ $@
|
||||
| | | |$@
|
||||
| | | |$@
|
||||
| | | |$@
|
||||
| `--' |$@
|
||||
\______/ $@
|
||||
$@@
|
||||
____ ____$@
|
||||
\ \ / /$@
|
||||
\ \/ /$ @
|
||||
\ /$ @
|
||||
\ /$ @
|
||||
\__/$ @
|
||||
$ @@
|
||||
____ __ ____$@
|
||||
\ \ / \ / /$@
|
||||
\ \/ \/ /$ @
|
||||
\ /$ @
|
||||
\ /\ /$ @
|
||||
\__/ \__/$ @
|
||||
$ @@
|
||||
___ ___$@
|
||||
\ \ / /$@
|
||||
\ V / $@
|
||||
> < $@
|
||||
/ . \ $@
|
||||
/__/ \__\$@
|
||||
$@@
|
||||
____ ____$@
|
||||
\ \ / /$@
|
||||
\ \/ /$ @
|
||||
\_ _/$ @
|
||||
| |$ @
|
||||
|__|$ @
|
||||
$ @@
|
||||
________ $@
|
||||
| / $@
|
||||
`---/ / $@
|
||||
/ / $@
|
||||
/ /----.@
|
||||
/________|@
|
||||
$@@
|
||||
____ @
|
||||
| |@
|
||||
| |-`@
|
||||
| | $@
|
||||
| | $@
|
||||
| |-.@
|
||||
|____|@@
|
||||
___ @
|
||||
\ \ $ @
|
||||
\ \$ @
|
||||
\ \$ @
|
||||
\ \$@
|
||||
\__\@
|
||||
@@
|
||||
____ @
|
||||
| |@
|
||||
`-| |@
|
||||
| |@
|
||||
| |@
|
||||
.-| |@
|
||||
|____|@@
|
||||
___ @
|
||||
/ \ @
|
||||
/--^--\@
|
||||
$@
|
||||
$@
|
||||
$@
|
||||
$@@
|
||||
@
|
||||
@
|
||||
@
|
||||
$ @
|
||||
$ @
|
||||
______ @
|
||||
|______|@@
|
||||
__ @
|
||||
( _)@
|
||||
\| @
|
||||
$ @
|
||||
$ @
|
||||
$ @
|
||||
@@
|
||||
___ $ @
|
||||
/ \ $ @
|
||||
/ ^ \$ @
|
||||
/ /_\ \$ @
|
||||
/ _____ \$ @
|
||||
/__/ \__\$@
|
||||
$@@
|
||||
.______ $@
|
||||
| _ \ $@
|
||||
| |_) |$@
|
||||
| _ < $@
|
||||
| |_) |$@
|
||||
|______/ $@
|
||||
$@@
|
||||
______$@
|
||||
/ |@
|
||||
| ,----'@
|
||||
| | $@
|
||||
| `----.@
|
||||
\______|@
|
||||
$@@
|
||||
_______ $@
|
||||
| \$@
|
||||
| .--. |@
|
||||
| | | |@
|
||||
| '--' |@
|
||||
|_______/$@
|
||||
$@@
|
||||
_______ @
|
||||
| ____|@
|
||||
| |__ $@
|
||||
| __| $@
|
||||
| |____ @
|
||||
|_______|@
|
||||
@@
|
||||
_______ @
|
||||
| ____|@
|
||||
| |__ $@
|
||||
| __| $@
|
||||
| | $ @
|
||||
|__| @
|
||||
@@
|
||||
_______ @
|
||||
/ _____|@
|
||||
| | __ $@
|
||||
| | |_ |$@
|
||||
| |__| |$@
|
||||
\______|$@
|
||||
$@@
|
||||
__ __ $@
|
||||
| | | |$@
|
||||
| |__| |$@
|
||||
| __ |$@
|
||||
| | | |$@
|
||||
|__| |__|$@
|
||||
$@@
|
||||
__ $@
|
||||
| |$@
|
||||
| |$@
|
||||
| |$@
|
||||
| |$@
|
||||
|__|$@
|
||||
$@@
|
||||
__ $@
|
||||
| |$@
|
||||
| |$@
|
||||
.--. | |$@
|
||||
| `--' |$@
|
||||
\______/ $@
|
||||
$@@
|
||||
__ ___$@
|
||||
| |/ /$@
|
||||
| ' / $@
|
||||
| < $@
|
||||
| . \ $@
|
||||
|__|\__\$@
|
||||
$@@
|
||||
__ $@
|
||||
| | $@
|
||||
| | $@
|
||||
| | $@
|
||||
| `----.@
|
||||
|_______|@
|
||||
$@@
|
||||
.___ ___.$@
|
||||
| \/ |$@
|
||||
| \ / |$@
|
||||
| |\/| |$@
|
||||
| | | |$@
|
||||
|__| |__|$@
|
||||
$@@
|
||||
.__ __.$@
|
||||
| \ | |$@
|
||||
| \| |$@
|
||||
| . ` |$@
|
||||
| |\ |$@
|
||||
|__| \__|$@
|
||||
$@@
|
||||
______ $@
|
||||
/ __ \ $@
|
||||
| | | |$@
|
||||
| | | |$@
|
||||
| `--' |$@
|
||||
\______/ $@
|
||||
$@@
|
||||
.______ $@
|
||||
| _ \ $@
|
||||
| |_) |$@
|
||||
| ___/ $@
|
||||
| | $ @
|
||||
| _| $ @
|
||||
$ @@
|
||||
______ $ @
|
||||
/ __ \ $ @
|
||||
| | | | $ @
|
||||
| | | | $ @
|
||||
| `--' '--. @
|
||||
\_____\_____\@
|
||||
$ @@
|
||||
.______ $ @
|
||||
| _ \ $ @
|
||||
| |_) | $ @
|
||||
| / $ @
|
||||
| |\ \----.@
|
||||
| _| `._____|@
|
||||
$@@
|
||||
_______.@
|
||||
/ |@
|
||||
| (----`@
|
||||
\ \ $@
|
||||
.----) | $@
|
||||
|_______/ $@
|
||||
$@@
|
||||
.___________.@
|
||||
| |@
|
||||
`---| |----`@
|
||||
| | $ @
|
||||
| | $ @
|
||||
|__| $ @
|
||||
$ @@
|
||||
__ __ $@
|
||||
| | | |$@
|
||||
| | | |$@
|
||||
| | | |$@
|
||||
| `--' |$@
|
||||
\______/ $@
|
||||
$@@
|
||||
____ ____$@
|
||||
\ \ / /$@
|
||||
\ \/ /$ @
|
||||
\ /$ @
|
||||
\ /$ @
|
||||
\__/$ @
|
||||
$ @@
|
||||
____ __ ____$@
|
||||
\ \ / \ / /$@
|
||||
\ \/ \/ /$ @
|
||||
\ /$ @
|
||||
\ /\ /$ @
|
||||
\__/ \__/$ @
|
||||
$ @@
|
||||
___ ___$@
|
||||
\ \ / /$@
|
||||
\ V / $@
|
||||
> < $@
|
||||
/ . \ $@
|
||||
/__/ \__\$@
|
||||
$@@
|
||||
____ ____$@
|
||||
\ \ / /$@
|
||||
\ \/ /$ @
|
||||
\_ _/$ @
|
||||
| |$ @
|
||||
|__|$ @
|
||||
$ @@
|
||||
________ $@
|
||||
| / $@
|
||||
`---/ / $@
|
||||
/ / $@
|
||||
/ /----.@
|
||||
/________|@
|
||||
$@@
|
||||
___@
|
||||
/ /@
|
||||
| |$@
|
||||
/ /$ @
|
||||
\ \$ @
|
||||
| |$@
|
||||
\__\@@
|
||||
__ $@
|
||||
| |$@
|
||||
| |$@
|
||||
| |$@
|
||||
| |$@
|
||||
| |$@
|
||||
|__|$@@
|
||||
___ @
|
||||
\ \$ @
|
||||
| | @
|
||||
\ \@
|
||||
/ /@
|
||||
| | @
|
||||
/__/$ @@
|
||||
__ _ @
|
||||
/ \/ |@
|
||||
|_/\__/ @
|
||||
$ @
|
||||
$ @
|
||||
$ @
|
||||
@@
|
||||
_ _ @
|
||||
(_)_(_) @
|
||||
/ \ @
|
||||
/ _ \ @
|
||||
/ ___ \ @
|
||||
/_/ \_\@
|
||||
@@
|
||||
_ _ @
|
||||
(_)_(_)@
|
||||
/ _ \ @
|
||||
| | | |@
|
||||
| |_| |@
|
||||
\___/ @
|
||||
@@
|
||||
_ _ @
|
||||
(_) (_)@
|
||||
| | | |@
|
||||
| | | |@
|
||||
| |_| |@
|
||||
\___/ @
|
||||
@@
|
||||
_ _ @
|
||||
(_) (_)@
|
||||
__ _ @
|
||||
/ _` |@
|
||||
| (_| |@
|
||||
\__,_|@
|
||||
@@
|
||||
_ _ @
|
||||
(_) (_)@
|
||||
___ @
|
||||
/ _ \ @
|
||||
| (_) |@
|
||||
\___/ @
|
||||
@@
|
||||
_ _ @
|
||||
(_) (_)@
|
||||
_ _ @
|
||||
| | | |@
|
||||
| |_| |@
|
||||
\__,_|@
|
||||
@@
|
||||
___ @
|
||||
/ _ \ @
|
||||
| | ) |@
|
||||
| |< < @
|
||||
| | ) |@
|
||||
| ||_/ @
|
||||
|_| @@
|
||||
46
src/Spectre.Console.Tests/EmbeddedResourceDataAttribute.cs
Normal file
46
src/Spectre.Console.Tests/EmbeddedResourceDataAttribute.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Xunit.Sdk;
|
||||
|
||||
namespace Spectre.Console.Tests
|
||||
{
|
||||
public sealed class EmbeddedResourceDataAttribute : DataAttribute
|
||||
{
|
||||
private readonly string _args;
|
||||
|
||||
public EmbeddedResourceDataAttribute(string args)
|
||||
{
|
||||
_args = args ?? throw new ArgumentNullException(nameof(args));
|
||||
}
|
||||
|
||||
public override IEnumerable<object[]> GetData(MethodInfo testMethod)
|
||||
{
|
||||
var result = new object[1];
|
||||
result[0] = ReadManifestData(_args);
|
||||
return new[] { result };
|
||||
}
|
||||
|
||||
public static string ReadManifestData(string resourceName)
|
||||
{
|
||||
if (resourceName is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(resourceName));
|
||||
}
|
||||
|
||||
using (var stream = ResourceReader.LoadResourceStream(resourceName))
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
throw new InvalidOperationException("Could not load manifest resource stream.");
|
||||
}
|
||||
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
return reader.ReadToEnd().NormalizeLineEndings();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
+-Greeting----+
|
||||
| Hello World |
|
||||
+-------------+
|
||||
@@ -0,0 +1,3 @@
|
||||
╔═Greeting════╗
|
||||
║ Hello World ║
|
||||
╚═════════════╝
|
||||
@@ -0,0 +1,3 @@
|
||||
┏━Greeting━━━━┓
|
||||
┃ Hello World ┃
|
||||
┗━━━━━━━━━━━━━┛
|
||||
@@ -0,0 +1,3 @@
|
||||
Greeting
|
||||
Hello World
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
╭─Greeting────╮
|
||||
│ Hello World │
|
||||
╰─────────────╯
|
||||
@@ -0,0 +1,3 @@
|
||||
┌─Greeting────┐
|
||||
│ Hello World │
|
||||
└─────────────┘
|
||||
@@ -0,0 +1,11 @@
|
||||
2020 October
|
||||
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
|
||||
├─────┼─────┼─────┼─────┼─────┼─────┼─────┤
|
||||
│ │ │ │ │ 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 │
|
||||
│ │ │ │ │ │ │ │
|
||||
└─────┴─────┴─────┴─────┴─────┴─────┴─────┘
|
||||
@@ -0,0 +1,11 @@
|
||||
2020 October
|
||||
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
|
||||
├─────┼─────┼─────┼─────┼─────┼─────┼─────┤
|
||||
│ │ │ │ │ 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 │
|
||||
│ │ │ │ │ │ │ │
|
||||
└─────┴─────┴─────┴─────┴─────┴─────┴─────┘
|
||||
@@ -0,0 +1,11 @@
|
||||
2020 October
|
||||
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
|
||||
├─────┼─────┼─────┼─────┼─────┼─────┼─────┤
|
||||
│ │ │ │ │ 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 │
|
||||
│ │ │ │ │ │ │ │
|
||||
└─────┴─────┴─────┴─────┴─────┴─────┴─────┘
|
||||
@@ -0,0 +1,11 @@
|
||||
Oktober 2020
|
||||
┌─────┬────┬────┬────┬────┬────┬────┐
|
||||
│ Mo │ Di │ Mi │ Do │ Fr │ Sa │ So │
|
||||
├─────┼────┼────┼────┼────┼────┼────┤
|
||||
│ │ │ │ 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 │ │
|
||||
│ │ │ │ │ │ │ │
|
||||
└─────┴────┴────┴────┴────┴────┴────┘
|
||||
@@ -0,0 +1,11 @@
|
||||
2020 October
|
||||
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
|
||||
├─────┼─────┼─────┼─────┼─────┼─────┼─────┤
|
||||
│ │ │ │ │ 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 │
|
||||
│ │ │ │ │ │ │ │
|
||||
└─────┴─────┴─────┴─────┴─────┴─────┴─────┘
|
||||
@@ -0,0 +1,4 @@
|
||||
╭────────────────────╮ ╭────────────────╮ ╭─────────────────╮
|
||||
│ Savannah Thompson │ │ Sophie Ramos │ │ Katrin Goldberg │
|
||||
│ Australia │ │ United States │ │ Germany │
|
||||
╰────────────────────╯ ╰────────────────╯ ╰─────────────────╯
|
||||
@@ -0,0 +1,4 @@
|
||||
System.InvalidOperationException: Throwing!
|
||||
at Spectre.Console.Tests.Data.TestExceptions.MethodThatThrows(Nullable`1 number) in /xyz/Exceptions.cs:nn
|
||||
at Spectre.Console.Tests.Unit.ExceptionTests.<>c.<Should_Write_Exception>b__0_0() in /xyz/ExceptionTests.cs:nn
|
||||
at Spectre.Console.Tests.Unit.ExceptionTests.GetException(Action action) in /xyz/ExceptionTests.cs:nn
|
||||
@@ -0,0 +1,7 @@
|
||||
System.InvalidOperationException: Something threw!
|
||||
System.InvalidOperationException: Throwing!
|
||||
at Spectre.Console.Tests.Data.TestExceptions.MethodThatThrows(Nullable`1 number) in /xyz/Exceptions.cs:nn
|
||||
at Spectre.Console.Tests.Data.TestExceptions.ThrowWithInnerException() in /xyz/Exceptions.cs:nn
|
||||
at Spectre.Console.Tests.Data.TestExceptions.ThrowWithInnerException() in /xyz/Exceptions.cs:nn
|
||||
at Spectre.Console.Tests.Unit.ExceptionTests.<>c.<Should_Write_Exception_With_Inner_Exception>b__3_0() in /xyz/ExceptionTests.cs:nn
|
||||
at Spectre.Console.Tests.Unit.ExceptionTests.GetException(Action action) in /xyz/ExceptionTests.cs:nn
|
||||
@@ -0,0 +1,4 @@
|
||||
System.InvalidOperationException: Throwing!
|
||||
at MethodThatThrows(Nullable`1 number) in /xyz/Exceptions.cs:nn
|
||||
at <Should_Write_Exception_With_Shortened_Methods>b__2_0() in /xyz/ExceptionTests.cs:nn
|
||||
at GetException(Action action) in /xyz/ExceptionTests.cs:nn
|
||||
@@ -0,0 +1,4 @@
|
||||
InvalidOperationException: Throwing!
|
||||
at Spectre.Console.Tests.Data.TestExceptions.MethodThatThrows(Nullable`1 number) in /xyz/Exceptions.cs:nn
|
||||
at Spectre.Console.Tests.Unit.ExceptionTests.<>c.<Should_Write_Exception_With_Shortened_Types>b__1_0() in /xyz/ExceptionTests.cs:nn
|
||||
at Spectre.Console.Tests.Unit.ExceptionTests.GetException(Action action) in /xyz/ExceptionTests.cs:nn
|
||||
@@ -0,0 +1,7 @@
|
||||
System.InvalidOperationException: Something threw!
|
||||
System.InvalidOperationException: Throwing!
|
||||
at Spectre.Console.Tests.Data.TestExceptions.GenericMethodThatThrows[[T0,T1,TRet]](Nullable`1 number) in /xyz/Exceptions.cs:nn
|
||||
at Spectre.Console.Tests.Data.TestExceptions.ThrowWithGenericInnerException() in /xyz/Exceptions.cs:nn
|
||||
at Spectre.Console.Tests.Data.TestExceptions.ThrowWithGenericInnerException() in /xyz/Exceptions.cs:nn
|
||||
at Spectre.Console.Tests.Unit.ExceptionTests.<>c.<Should_Write_Exceptions_With_Generic_Type_Parameters_In_Callsite_As_Expected>b__4_0() in /xyz/ExceptionTests.cs:nn
|
||||
at Spectre.Console.Tests.Unit.ExceptionTests.GetException(Action action) in /xyz/ExceptionTests.cs:nn
|
||||
@@ -0,0 +1,7 @@
|
||||
.______ ___ .___________..______ __ __ ___ ____ __ ____ ___ _______. __ __ _______ .______ _______
|
||||
| _ \ / \ | || _ \ | | | |/ / \ \ / \ / / / \ / | | | | | | ____|| _ \ | ____|
|
||||
| |_) | / ^ \ `---| |----`| |_) | | | | ' / \ \/ \/ / / ^ \ | (----` | |__| | | |__ | |_) | | |__
|
||||
| ___/ / /_\ \ | | | / | | | < \ / / /_\ \ \ \ | __ | | __| | / | __|
|
||||
| | / _____ \ | | | |\ \----.| | | . \ \ /\ / / _____ \ .----) | | | | | | |____ | |\ \----.| |____
|
||||
| _| /__/ \__\ |__| | _| `._____||__| |__|\__\ \__/ \__/ /__/ \__\ |_______/ |__| |__| |_______|| _| `._____||_______|
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
____ _ ____ _
|
||||
/ ___| _ __ ___ ___ | |_ _ __ ___ / ___| ___ _ __ ___ ___ | | ___
|
||||
\___ \ | '_ \ / _ \ / __| | __| | '__| / _ \ | | / _ \ | '_ \ / __| / _ \ | | / _ \
|
||||
___) | | |_) | | __/ | (__ | |_ | | | __/ _ | |___ | (_) | | | | | \__ \ | (_) | | | | __/
|
||||
|____/ | .__/ \___| \___| \__| |_| \___| (_) \____| \___/ |_| |_| |___/ \___/ |_| \___|
|
||||
|_|
|
||||
@@ -0,0 +1,6 @@
|
||||
____ _ ____ _
|
||||
/ ___| _ __ ___ ___ | |_ _ __ ___ / ___| ___ _ __ ___ ___ | | ___
|
||||
\___ \ | '_ \ / _ \ / __| | __| | '__| / _ \ | | / _ \ | '_ \ / __| / _ \ | | / _ \
|
||||
___) | | |_) | | __/ | (__ | |_ | | | __/ _ | |___ | (_) | | | | | \__ \ | (_) | | | | __/
|
||||
|____/ | .__/ \___| \___| \__| |_| \___| (_) \____| \___/ |_| |_| |___/ \___/ |_| \___|
|
||||
|_|
|
||||
@@ -0,0 +1,6 @@
|
||||
____ _ ____ _
|
||||
/ ___| _ __ ___ ___ | |_ _ __ ___ / ___| ___ _ __ ___ ___ | | ___
|
||||
\___ \ | '_ \ / _ \ / __| | __| | '__| / _ \ | | / _ \ | '_ \ / __| / _ \ | | / _ \
|
||||
___) | | |_) | | __/ | (__ | |_ | | | __/ _ | |___ | (_) | | | | | \__ \ | (_) | | | | __/
|
||||
|____/ | .__/ \___| \___| \__| |_| \___| (_) \____| \___/ |_| |_| |___/ \___/ |_| \___|
|
||||
|_|
|
||||
@@ -0,0 +1,12 @@
|
||||
____ _ _ _
|
||||
| _ \ __ _ | |_ _ __ (_) | | __ __ __ __ _ ___
|
||||
| |_) | / _` | | __| | '__| | | | |/ / \ \ /\ / / / _` | / __|
|
||||
| __/ | (_| | | |_ | | | | | < \ V V / | (_| | \__ \
|
||||
|_| \__,_| \__| |_| |_| |_|\_\ \_/\_/ \__,_| |___/
|
||||
|
||||
_
|
||||
| |__ ___ _ __ ___
|
||||
| '_ \ / _ \ | '__| / _ \
|
||||
| | | | | __/ | | | __/
|
||||
|_| |_| \___| |_| \___|
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
____ _ ____
|
||||
/ ___| _ __ ___ ___ | |_ _ __ ___ / ___| ___
|
||||
\___ \ | '_ \ / _ \ / __| | __| | '__| / _ \ | | / _ \
|
||||
___) | | |_) | | __/ | (__ | |_ | | | __/ _ | |___ | (_) |
|
||||
|____/ | .__/ \___| \___| \__| |_| \___| (_) \____| \___/
|
||||
|_|
|
||||
_
|
||||
_ __ ___ ___ | | ___
|
||||
| '_ \ / __| / _ \ | | / _ \
|
||||
| | | | \__ \ | (_) | | | | __/
|
||||
|_| |_| |___/ \___/ |_| \___|
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Foo Bar Baz
|
||||
Qux Corgi Waldo
|
||||
GraultGarplyFred
|
||||
@@ -0,0 +1,4 @@
|
||||
Options
|
||||
-h, --help Show command line help.
|
||||
-c, --configuration The configuration to run for.
|
||||
The default for most projects is Debug.
|
||||
@@ -0,0 +1,3 @@
|
||||
Foo Bar Baz
|
||||
Qux Corgi Waldo
|
||||
Grault Garply Fred
|
||||
@@ -0,0 +1,2 @@
|
||||
Qux Corgi Waldo
|
||||
Grault Garply Fred
|
||||
@@ -0,0 +1,3 @@
|
||||
Foo Bar Baz
|
||||
Qux Corgi Waldo
|
||||
Grault Garply Fred
|
||||
@@ -0,0 +1,3 @@
|
||||
Foo Bar
|
||||
|
||||
Qux Corgi
|
||||
@@ -0,0 +1,4 @@
|
||||
Foo Bar
|
||||
|
||||
Qux Corgi
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
┌───────┬───────┐
|
||||
│ Foo │ Bar │
|
||||
├───────┼───────┤
|
||||
│ Baz │ Qux │
|
||||
│ Corgi │ Waldo │
|
||||
└───────┴───────┘
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
┌───────┬───────┐
|
||||
│ Foo │ Bar │
|
||||
├───────┼───────┤
|
||||
│ Baz │ Qux │
|
||||
│ Corgi │ Waldo │
|
||||
└───────┴───────┘
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
┌───────┬─────────────┐
|
||||
│ Foo │Bar │
|
||||
├───────┼─────────────┤
|
||||
│ Baz │Qux │
|
||||
│ Corgi │ │
|
||||
│ │ ┌───────┐ │
|
||||
│ │ │ Waldo │ │
|
||||
│ │ └───────┘ │
|
||||
│ │ │
|
||||
└───────┴─────────────┘
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
┌───────────────────────┐
|
||||
│ Hello World │
|
||||
└───────────────────────┘
|
||||
@@ -0,0 +1,4 @@
|
||||
┌─Greet…─┐
|
||||
│ Hello │
|
||||
│ World │
|
||||
└────────┘
|
||||
@@ -0,0 +1,3 @@
|
||||
┌──────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Hello World │
|
||||
└──────────────────────────────────────────────────────────────────────────────┘
|
||||
@@ -0,0 +1,3 @@
|
||||
┌───────────────────────┐
|
||||
│ Hello World │
|
||||
└───────────────────────┘
|
||||
@@ -0,0 +1,7 @@
|
||||
┌───────────────────────┐
|
||||
│ I heard you like 📦 │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ So I put a 📦 in a 📦 │
|
||||
└───────────────────────┘
|
||||
@@ -0,0 +1,3 @@
|
||||
┌─────────────┐
|
||||
│ Hello World │
|
||||
└─────────────┘
|
||||
@@ -0,0 +1,5 @@
|
||||
┌─────────────────┐
|
||||
│ ┌─────────────┐ │
|
||||
│ │ Hello World │ │
|
||||
│ └─────────────┘ │
|
||||
└─────────────────┘
|
||||
@@ -0,0 +1,3 @@
|
||||
┌───────────────────────────────────Greeting───────────────────────────────────┐
|
||||
│ Hello World │
|
||||
└──────────────────────────────────────────────────────────────────────────────┘
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user