mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-10-25 15:19:23 +00:00
Compare commits
43 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5125d640c | ||
|
|
a59e0dcb21 | ||
|
|
bde61cc6ff | ||
|
|
5c33b87a9c | ||
|
|
aaf77c3b25 | ||
|
|
d70ad661fc | ||
|
|
0d209d8f18 | ||
|
|
380c6aca45 | ||
|
|
b1da5e7ba8 | ||
|
|
be3350a411 | ||
|
|
a1d11e9d0c | ||
|
|
93d1971f48 | ||
|
|
bca1c889d1 | ||
|
|
9915a0d6a8 | ||
|
|
f34fc43d00 | ||
|
|
e7f497050c | ||
|
|
3e5e22d6c2 | ||
|
|
10daf727e9 | ||
|
|
03334f693d | ||
|
|
c9c0ad733f | ||
|
|
041bd016a2 | ||
|
|
037a215a78 | ||
|
|
9afc1ea721 | ||
|
|
b52056ee49 | ||
|
|
3941fd81ab | ||
|
|
5a1b8a1710 | ||
|
|
1410cba6c5 | ||
|
|
70fc14e9cd | ||
|
|
0b4359a52a | ||
|
|
cb2924a609 | ||
|
|
5c119ee0c3 | ||
|
|
b9d182b6e3 | ||
|
|
bfffef630f | ||
|
|
a2f507e58f | ||
|
|
d1d06d6a6b | ||
|
|
52718c499c | ||
|
|
7ef1ac483a | ||
|
|
c0875c912a | ||
|
|
3f2ca49071 | ||
|
|
0a0380ae0a | ||
|
|
ae92c606bb | ||
|
|
68e92f3365 | ||
|
|
39a8588dc3 |
22
.github/workflows/ci.yaml
vendored
22
.github/workflows/ci.yaml
vendored
@@ -21,7 +21,7 @@ jobs:
|
|||||||
- name: Setup dotnet
|
- name: Setup dotnet
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: '3.1.301' # SDK Version to use.
|
dotnet-version: 5.0.100
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -55,10 +55,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup dotnet
|
- name: Setup dotnet 3.1.402
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v1
|
||||||
with:
|
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
|
- name: Integration Tests
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -71,9 +76,18 @@ jobs:
|
|||||||
dotnet example colors
|
dotnet example colors
|
||||||
dotnet example emojis
|
dotnet example emojis
|
||||||
dotnet example exceptions
|
dotnet example exceptions
|
||||||
|
dotnet example calendars
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
dotnet tool restore
|
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
|
- name: Setup dotnet
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: '3.1.301' # SDK Version to use.
|
dotnet-version: 5.0.100
|
||||||
|
|
||||||
- name: Publish
|
- name: Publish
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
20
.github/workflows/publish.yaml
vendored
20
.github/workflows/publish.yaml
vendored
@@ -29,7 +29,7 @@ jobs:
|
|||||||
- name: Setup dotnet
|
- name: Setup dotnet
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: '3.1.301' # SDK Version to use.
|
dotnet-version: 5.0.100
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -64,10 +64,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup dotnet
|
- name: Setup dotnet 3.1.402
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v1
|
||||||
with:
|
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
|
- name: Build
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -90,10 +95,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup dotnet
|
- name: Setup dotnet 3.1.402
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v1
|
||||||
with:
|
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
|
- name: Publish
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -88,3 +88,5 @@ packages
|
|||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
|
*.received.*
|
||||||
413
README.jp.md
Normal file
413
README.jp.md
Normal file
@@ -0,0 +1,413 @@
|
|||||||
|
# `Spectre.Console`
|
||||||
|
|
||||||
|
_[](https://www.nuget.org/packages/spectre.console)_
|
||||||
|
|
||||||
|
綺麗なコンソールアプリケーションを簡単に作成するための.NET Standard 2.0ライブラリです。
|
||||||
|
Python用の素晴らしい[Rich ライブラリ](https://github.com/willmcgugan/rich)に強く影響を受けています。
|
||||||
|
|
||||||
|
## 目次
|
||||||
|
|
||||||
|
1. [特徴](#特徴)
|
||||||
|
2. [例](#例)
|
||||||
|
3. [使用方法](#使用方法)
|
||||||
|
3.1. [Static APIの利用](#static-apiの利用)
|
||||||
|
3.2. [コンソールの作成](#コンソールの作成)
|
||||||
|
4. [例の実行](#例の実行)
|
||||||
|
5. [クイックスタート](#クイックスタート)
|
||||||
|
6. [マークアップ](#マークアップ)
|
||||||
|
7. [絵文字](#絵文字)
|
||||||
|
8. [テーブル](#テーブル)
|
||||||
|
9. [例外](#例外)
|
||||||
|
|
||||||
|
## 特徴
|
||||||
|
|
||||||
|
* ユニットテストを意識して書いています。
|
||||||
|
* table、grid、panel、マークアップ言語に影響を受けた [rich](https://github.com/willmcgugan/rich) に対応しています。
|
||||||
|
* 太字、薄字、斜字、下線、斜線、点滅などの一般的なSGR parameters に対応しています。
|
||||||
|
* ターミナルで 3/4/8/24ビットカラーに対応しています。
|
||||||
|
ライブラリは現在のターミナルの性能を検知し、必要なカラーにダウングレードします
|
||||||
|
|
||||||
|
## 例
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 使用方法
|
||||||
|
|
||||||
|
`Spectre.Console` APIはステートフルで、スレッドセーフではありません。
|
||||||
|
異なるスレッドからコンソールに書く必要がある場合、通常の`System.Console` APIを使用するときと同様、適切な注意を払ってください。
|
||||||
|
|
||||||
|
現在の端末がANSIエスケープシーケンスに対応していない場合、
|
||||||
|
`Spectre.Console`は、`System.Console` APIの利用に切り替わります。
|
||||||
|
|
||||||
|
_メモ: このライブラリは現在開発中で、APIは1.0のリリースまでの間に変更されたり、
|
||||||
|
削除されたりする可能性があります。_
|
||||||
|
|
||||||
|
### Static APIの利用
|
||||||
|
|
||||||
|
|
||||||
|
`System.Console` APIでするように、テキストを出力したいだけの時にはstatic APIが最適ですが、綺麗です。
|
||||||
|
|
||||||
|
```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");
|
||||||
|
```
|
||||||
|
|
||||||
|
もし、デフォルトの`IAnsiConsole`への参照を取得したい場合、
|
||||||
|
`AnsiConsole.Console`経由でアクセスできます。
|
||||||
|
|
||||||
|
### コンソールの作成
|
||||||
|
|
||||||
|
単体テスト中にコードの実行環境を制御したい場合など、
|
||||||
|
特定の機能をもつコンソールを明示的に作成すると便利なことがあります。
|
||||||
|
|
||||||
|
単体テストの一部としてコードで `AnsiConsole`を使わないことを推奨します。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
IAnsiConsole console = AnsiConsole.Create(
|
||||||
|
new AnsiConsoleSettings()
|
||||||
|
{
|
||||||
|
Ansi = AnsiSupport.Yes,
|
||||||
|
ColorSystem = ColorSystemSupport.TrueColor,
|
||||||
|
Out = new StringWriter(),
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
_メモ: 主導でコンソールを作成しているときに特定のカラーシステムを指定できたとしても、
|
||||||
|
ユーザーのターミナルでは使えないかもしれないことを覚えておいてください。
|
||||||
|
テスト用にIAnsiConsoleを作成していない限り、
|
||||||
|
常に`ColorSystemSupport.Detect` と `AnsiSupport.Detect`を使用してください。_
|
||||||
|
|
||||||
|
## 例の実行
|
||||||
|
|
||||||
|
Spectre.Consoleでできることを見るために、
|
||||||
|
[dotnet-example](https://github.com/patriksvensson/dotnet-example)グローバルツールをインストールします。
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
> dotnet tool restore
|
||||||
|
```
|
||||||
|
|
||||||
|
このリポジトリで提供している例が一覧表示されます
|
||||||
|
|
||||||
|
```
|
||||||
|
> 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. │
|
||||||
|
╰────────────┴───────────────────────────────────────┴──────────────────────────────────────────────────────╯
|
||||||
|
```
|
||||||
|
|
||||||
|
そして、例を実行します
|
||||||
|
|
||||||
|
```
|
||||||
|
> dotnet example tables
|
||||||
|
┌──────────┬──────────┬────────┐
|
||||||
|
│ Foo │ Bar │ Baz │
|
||||||
|
├──────────┼──────────┼────────┤
|
||||||
|
│ Hello │ World! │ │
|
||||||
|
│ Bonjour │ le │ monde! │
|
||||||
|
│ Hej │ Världen! │ │
|
||||||
|
└──────────┴──────────┴────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
## クイックスタート
|
||||||
|
pectre.Consoleの利用を開始する最初の方法は、Nugetパッケージをインストールすることです。
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> dotnet add package Spectre.Console
|
||||||
|
```
|
||||||
|
|
||||||
|
その後、`Spectre.Console`名前空間を参照する必要があります。一度参照したら、提供されている全ての機能を使用できます。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using Spectre.Console
|
||||||
|
|
||||||
|
public static class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
AnsiConsole.Markup("[underline red]Hello[/] World!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## マークアップ
|
||||||
|
`Markup`クラスは、コンソールにリッチなテキストを出力することができます。
|
||||||
|
|
||||||
|
### 文法
|
||||||
|
|
||||||
|
コンソールマークアップはbbcodeに影響を受けた文法を利用します。角括弧でスタイルを書いたら(スタイルを参照)、例えば、`[bold red]`
|
||||||
|
は、`[/]`で閉じるまでスタイルが適用されます。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
AnsiConsole.Render(new Markup("[bold yellow]Hello[/] [red]World![/]"));
|
||||||
|
```
|
||||||
|
|
||||||
|
`Markup` クラスは`IRenderable`を実装しており、table、grid、Panelを使用できることを意味します。
|
||||||
|
`IRenderable`のレンダリングに対応している多くのクラスは、リッチテキストの描画を上書きます。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var table = new Table();
|
||||||
|
table.AddColumn(new TableColumn(new Markup("[yellow]Foo[/]")));
|
||||||
|
table.AddColumn(new TableColumn("[blue]Bar[/]"));
|
||||||
|
```
|
||||||
|
|
||||||
|
### 便利なメソッド
|
||||||
|
|
||||||
|
`AnsiConsole`には、新しい`Markup`インスタンスをインスタンス化することなく、コンソールにマークアップテキストを書き込める便利なメソッドがあります。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
AnsiConsole.Markup("[underline green]Hello[/] ");
|
||||||
|
AnsiConsole.MarkupLine("[bold]World[/]");
|
||||||
|
```
|
||||||
|
|
||||||
|
### エスケープ文字列
|
||||||
|
|
||||||
|
`[`を出力するために、 `[[`を利用し、`]`を出力するために`]]`を利用します。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
AnsiConsole.Markup("[[Hello]] "); // [Hello]
|
||||||
|
AnsiConsole.Markup("[red][[World]][/]"); // [World]
|
||||||
|
```
|
||||||
|
|
||||||
|
`SafeMarkup`拡張メソッドを使用することもできます。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
AnsiConsole.Markup("[red]{0}[/]", "Hello [World]".SafeMarkup());
|
||||||
|
```
|
||||||
|
|
||||||
|
### カラー
|
||||||
|
|
||||||
|
`new Style(foreground: Color.Maroon)`のようなコード、または、`AnsiConsole.Markup("[maroon on blue]Hello[/]")`のようなマークアップテキストで色を使用できます。
|
||||||
|
|
||||||
|
### 背景色の設定
|
||||||
|
|
||||||
|
カラー指定の際に、`on`を付けることで、マークアップで背景色を設定できます。
|
||||||
|
|
||||||
|
```
|
||||||
|
[bold yellow on blue]Hello[/]
|
||||||
|
[default on blue]World[/]
|
||||||
|
```
|
||||||
|
|
||||||
|
### 絵文字の描画
|
||||||
|
|
||||||
|
マークアップの一部として絵文字を出力するために、emojiショートコードが使用できます。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
AnsiConsole.MarkupLine("Hello :globe_showing_europe_africa:!");
|
||||||
|
```
|
||||||
|
|
||||||
|
emojiのスタイルについては、付録の[Emoji](./appendix/emojis) を参照してください。
|
||||||
|
|
||||||
|
### カラー
|
||||||
|
|
||||||
|
上の例では、全ての色は名前で参照されています。
|
||||||
|
しかし、16進数やRGB表現をマークダウンで色指定に使用できます。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
AnsiConsole.Markup("[red]Foo[/] ");
|
||||||
|
AnsiConsole.Markup("[#ff0000]Bar[/] ");
|
||||||
|
AnsiConsole.Markup("[rgb(255,0,0)]Baz[/] ");
|
||||||
|
```
|
||||||
|
|
||||||
|
## 絵文字
|
||||||
|
|
||||||
|
どのような絵文字が使用できるかは、使用しているOSやターミナルに依存し、どのように表示されるかは保証されません。絵文字の幅計算は正確ではないため、表、パネル、グリッドで使用する場合は表示がずれるかもしれません。
|
||||||
|
|
||||||
|
完全な互換性を確保するために、Unicode 13.0 より以前の`Emoji_Presentation`カテゴリにあるものだけを使用することを検討してください。
|
||||||
|
公式の絵文字一覧
|
||||||
|
https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt
|
||||||
|
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
// Markup
|
||||||
|
AnsiConsole.MarkupLine("Hello :globe_showing_europe_africa:!");
|
||||||
|
|
||||||
|
// Constant
|
||||||
|
var hello = "Hello " + Emoji.Known.GlobeShowingEuropeAfrica;
|
||||||
|
```
|
||||||
|
|
||||||
|
テキスト内の絵文字を置き換えることができます。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var phrase = "Mmmm :birthday_cake:";
|
||||||
|
var rendered
|
||||||
|
```
|
||||||
|
|
||||||
|
既存の絵文字を別のものにしたり、完全に新しい物を追加したいことがあります。このために、`Emoji.Remap`メソッドを使用できます。
|
||||||
|
この方法は、マークアップ文字と`Emoji.Replace`の両方で動作します。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
// Remap the emoji
|
||||||
|
Emoji.Remap("globe_showing_europe_africa", "😄");
|
||||||
|
|
||||||
|
// Render markup
|
||||||
|
AnsiConsole.MarkupLine("Hello :globe_showing_europe_africa:!");
|
||||||
|
|
||||||
|
// Replace emojis in string
|
||||||
|
var phrase = "Hello :globe_showing_europe_africa:!";
|
||||||
|
var rendered = Emoji.Replace(phrase);
|
||||||
|
```
|
||||||
|
|
||||||
|
## テーブル
|
||||||
|
|
||||||
|
テーブルはターミナルで表データを表示するのに完璧な方法です。
|
||||||
|
`Spectre.Console` は、テーブルの描画にとても優れていて、全てのカラムは中に合わせて調整してくれます。
|
||||||
|
`IRenderable`を実装しているものは、列ヘッダやセル、別のテーブルとして使用できます。
|
||||||
|
|
||||||
|
### 使い方
|
||||||
|
|
||||||
|
テーブルを描画するために、`Table`インスタンスを作成し、必要な数の列を追加し、行を追加します。
|
||||||
|
テーブルをコンソールの`Render`メソッドに渡して終わりです。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
// テーブルの作成
|
||||||
|
var table = new Table();
|
||||||
|
|
||||||
|
// 列の追加
|
||||||
|
table.AddColumn("Foo");
|
||||||
|
table.AddColumn(new TableColumn("Bar").Centered());
|
||||||
|
|
||||||
|
// 行の追加
|
||||||
|
table.AddRow("Baz", "[green]Qux[/]");
|
||||||
|
table.AddRow(new Markup("[blue]Corgi[/]"), new Panel("Waldo"));
|
||||||
|
|
||||||
|
// コンソールにテーブルの描画
|
||||||
|
AnsiConsole.Render(table);
|
||||||
|
```
|
||||||
|
|
||||||
|
これは次のように出力を描画します。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 罫線
|
||||||
|
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
// 罫線を設定します
|
||||||
|
table.SetBorder(Border.None);
|
||||||
|
table.SetBorder(Border.Ascii);
|
||||||
|
table.SetBorder(Border.Square);
|
||||||
|
table.SetBorder(Border.Rounded);
|
||||||
|
```
|
||||||
|
|
||||||
|
### 拡大 / 縮小
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
// テーブル幅を最大に設定します
|
||||||
|
table.Expand();
|
||||||
|
|
||||||
|
// テーブル幅を最小に設定します
|
||||||
|
table.Collapse();
|
||||||
|
```
|
||||||
|
|
||||||
|
### ヘッダーを隠す
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
// 全ての列のヘッダーを隠します
|
||||||
|
table.HideHeaders();
|
||||||
|
```
|
||||||
|
|
||||||
|
### テーブル幅の設定
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
// テーブル幅50セルに設定します
|
||||||
|
table.SetWidth(50);
|
||||||
|
```
|
||||||
|
|
||||||
|
### 整列(アライメント)
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
// 整列を明示的に設定する
|
||||||
|
column.SetAlignment(Justify.Right);
|
||||||
|
```
|
||||||
|
|
||||||
|
### パディング
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
// 左と右のパディングを設定する
|
||||||
|
column.SetPadding(left: 3, right: 5);
|
||||||
|
|
||||||
|
// 個別にパディングを設定する
|
||||||
|
column.PadLeft(3);
|
||||||
|
column.PadRight(5);
|
||||||
|
```
|
||||||
|
|
||||||
|
### 列改行の無効化
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
// 列改行の無効化
|
||||||
|
column.NoWrap();
|
||||||
|
```
|
||||||
|
|
||||||
|
### 列幅の設定
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
// 列幅の設定(これはまだ柔軟な拡張メソッドがありません)
|
||||||
|
column.Width = 15;
|
||||||
|
```
|
||||||
|
|
||||||
|
## 例外
|
||||||
|
例外はターミナルで見たときに読みやすいとは限りません。
|
||||||
|
`WriteException`メソッドを使用することで、例外をもう少し読みやすくすることができます。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
AnsiConsole.WriteException(ex);
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
### 例外の省略表示
|
||||||
|
|
||||||
|
例外の特定部分を短くして、さらに読みやすくしたり、パスをクリック可能なハイパーリンクにすることもできます。
|
||||||
|
ハイパーリンクがクリックできるかはターミナル次第です。
|
||||||
|
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
AnsiConsole.WriteException(ex,
|
||||||
|
ExceptionFormats.ShortenPaths | ExceptionFormats.ShortenTypes |
|
||||||
|
ExceptionFormats.ShortenMethods | ExceptionFormats.ShowLinks);
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 例外出力のカスタマイズ
|
||||||
|
|
||||||
|
例外の特定部分を短縮するだけでなく、デフォルトのスタイルを上書きすることもできます。
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
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),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
47
README.md
47
README.md
@@ -10,10 +10,11 @@ for Python.
|
|||||||
|
|
||||||
1. [Features](#features)
|
1. [Features](#features)
|
||||||
2. [Example](#example)
|
2. [Example](#example)
|
||||||
3. [Usage](#usage)
|
3. [Installing](#installing)
|
||||||
3.1. [Using the static API](#using-the-static-api)
|
4. [Usage](#usage)
|
||||||
3.2. [Creating a console](#creating-a-console)
|
4.1. [Using the static API](#using-the-static-api)
|
||||||
4. [Running examples](#running-examples)
|
4.2. [Creating a console](#creating-a-console)
|
||||||
|
5. [Running examples](#running-examples)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -30,6 +31,14 @@ for Python.
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## Installing
|
||||||
|
|
||||||
|
The fastest way of getting started using Spectre.Console is to install the NuGet package.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
dotnet add package Spectre.Console
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
The `Spectre.Console` API is stateful and is not thread-safe.
|
The `Spectre.Console` API is stateful and is not thread-safe.
|
||||||
@@ -40,7 +49,7 @@ regular `System.Console` API.
|
|||||||
If the current terminal does not support ANSI escape sequences,
|
If the current terminal does not support ANSI escape sequences,
|
||||||
`Spectre.Console` will fallback to using the `System.Console` API.
|
`Spectre.Console` will fallback to using the `System.Console` API.
|
||||||
|
|
||||||
_NOTE: This library is currently under development and API's
|
_NOTE: This library is currently under development and APIs
|
||||||
might change or get removed at any point up until a 1.0 release._
|
might change or get removed at any point up until a 1.0 release._
|
||||||
|
|
||||||
### Using the static API
|
### Using the static API
|
||||||
@@ -91,7 +100,7 @@ To see Spectre.Console in action, install the
|
|||||||
global tool.
|
global tool.
|
||||||
|
|
||||||
```
|
```
|
||||||
> dotnet tool install -g dotnet-example
|
> dotnet tool restore
|
||||||
```
|
```
|
||||||
|
|
||||||
Now you can list available examples in this repository:
|
Now you can list available examples in this repository:
|
||||||
@@ -99,20 +108,28 @@ Now you can list available examples in this repository:
|
|||||||
```
|
```
|
||||||
> dotnet example
|
> dotnet example
|
||||||
|
|
||||||
╭────────┬───────────────────────────────┬─────────────────────────────────────────────────╮
|
╭────────────┬───────────────────────────────────────┬──────────────────────────────────────────────────────╮
|
||||||
│ Name │ Path │ Description │
|
│ Name │ Path │ Description │
|
||||||
├────────┼───────────────────────────────┼─────────────────────────────────────────────────┤
|
├────────────┼───────────────────────────────────────┼──────────────────────────────────────────────────────┤
|
||||||
│ Colors │ examples/Colors/Colors.csproj │ Demonstrates how to use colors in the console. │
|
│ Borders │ examples/Borders/Borders.csproj │ Demonstrates the different kind of borders. │
|
||||||
│ Grid │ examples/Grid/Grid.csproj │ Demonstrates how to render grids in a console. │
|
│ Calendars │ examples/Calendars/Calendars.csproj │ Demonstrates how to render calendars. │
|
||||||
│ Panel │ examples/Panel/Panel.csproj │ Demonstrates how to render items in panels. │
|
│ Colors │ examples/Colors/Colors.csproj │ Demonstrates how to use colors in the console. │
|
||||||
│ Table │ examples/Table/Table.csproj │ Demonstrates how to render tables in a 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:
|
And to run an example:
|
||||||
|
|
||||||
```
|
```
|
||||||
> dotnet example table
|
> dotnet example tables
|
||||||
┌──────────┬──────────┬────────┐
|
┌──────────┬──────────┬────────┐
|
||||||
│ Foo │ Bar │ Baz │
|
│ Foo │ Bar │ Baz │
|
||||||
├──────────┼──────────┼────────┤
|
├──────────┼──────────┼────────┤
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
|
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
|
||||||
<DefaultItemExcludes>$(DefaultItemExcludes);output\**;.gitignore</DefaultItemExcludes>
|
<DefaultItemExcludes>$(DefaultItemExcludes);output\**;.gitignore</DefaultItemExcludes>
|
||||||
<MinVerSkip Condition="'$(Configuration)' == 'Debug'">true</MinVerSkip>
|
<MinVerSkip Condition="'$(Configuration)' == 'Debug'">true</MinVerSkip>
|
||||||
@@ -31,8 +31,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Statiq.Web" Version="1.0.0-beta.5" />
|
<PackageReference Include="Statiq.Web" Version="1.0.0-beta.13" />
|
||||||
<PackageReference Include="MinVer" PrivateAssets="All" Version="2.3.0" />
|
<PackageReference Include="MinVer" PrivateAssets="All" Version="2.3.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<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"
|
> 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.**
|
**Note that the site runs under a virtual directory.**
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,7 @@
|
|||||||
<div class="sidebar-nav-item @(Document.IdEquals(root) ? "active" : null)">
|
<div class="sidebar-nav-item @(Document.IdEquals(root) ? "active" : null)">
|
||||||
@if(root.ShowLink())
|
@if(root.ShowLink())
|
||||||
{
|
{
|
||||||
@Html.DocumentLink(root)
|
@Html.DocumentLink(root)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -140,6 +140,11 @@
|
|||||||
|
|
||||||
@foreach (IDocument document in OutputPages.GetChildrenOf(root).OnlyVisible())
|
@foreach (IDocument document in OutputPages.GetChildrenOf(root).OnlyVisible())
|
||||||
{
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(document.GetTitle()))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
DocumentList<IDocument> documentChildren = OutputPages.GetChildrenOf(document);
|
DocumentList<IDocument> documentChildren = OutputPages.GetChildrenOf(document);
|
||||||
<div class="sidebar-nav-item @(Document.IdEquals(document) ? "active" : null) @(documentChildren.Any() ? "has-children" : null)">
|
<div class="sidebar-nav-item @(Document.IdEquals(document) ? "active" : null) @(documentChildren.Any() ? "has-children" : null)">
|
||||||
@if(document.ShowLink())
|
@if(document.ShowLink())
|
||||||
|
|||||||
@@ -30,6 +30,25 @@ var phrase = "Mmmm :birthday_cake:";
|
|||||||
var rendered = Emoji.Replace(phrase);
|
var rendered = Emoji.Replace(phrase);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Remapping or adding an emoji
|
||||||
|
|
||||||
|
Sometimes you want to remap an existing emoji, or
|
||||||
|
add a completely new one. For this you can use the
|
||||||
|
`Emoji.Remap` method. This approach works both with
|
||||||
|
markup strings and `Emoji.Replace`.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
// Remap the emoji
|
||||||
|
Emoji.Remap("globe_showing_europe_africa", "😄");
|
||||||
|
|
||||||
|
// Render markup
|
||||||
|
AnsiConsole.MarkupLine("Hello :globe_showing_europe_africa:!");
|
||||||
|
|
||||||
|
// Replace emojis in string
|
||||||
|
var phrase = "Hello :globe_showing_europe_africa:!";
|
||||||
|
var rendered = Emoji.Replace(phrase);
|
||||||
|
```
|
||||||
|
|
||||||
# Emojis
|
# Emojis
|
||||||
|
|
||||||
_The images in the table below might not render correctly in your
|
_The images in the table below might not render correctly in your
|
||||||
|
|||||||
BIN
docs/input/assets/images/custom_exception.png
Normal file
BIN
docs/input/assets/images/custom_exception.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 159 KiB |
BIN
docs/input/assets/images/rule.png
Normal file
BIN
docs/input/assets/images/rule.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
BIN
docs/input/assets/images/table.gif
Normal file
BIN
docs/input/assets/images/table.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
@@ -9,9 +9,9 @@ You can make exception a bit more readable by using the `WriteException` method.
|
|||||||
AnsiConsole.WriteException(ex);
|
AnsiConsole.WriteException(ex);
|
||||||
```
|
```
|
||||||
|
|
||||||
<img src="assets/images/exception.png" style="max-width: 100%; margin-bottom: 20px">
|
<img src="assets/images/exception.png" style="max-width: 100%;">
|
||||||
|
|
||||||
|
|
||||||
|
## Shortening parts
|
||||||
|
|
||||||
You can also shorten specific parts of the exception to make it even
|
You can also shorten specific parts of the exception to make it even
|
||||||
more readable, and make paths clickable hyperlinks. Whether or not
|
more readable, and make paths clickable hyperlinks. Whether or not
|
||||||
@@ -19,8 +19,34 @@ the hyperlinks are clickable is up to the terminal.
|
|||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
AnsiConsole.WriteException(ex,
|
AnsiConsole.WriteException(ex,
|
||||||
ExceptionFormat.ShortenPaths | ExceptionFormat.ShortenTypes |
|
ExceptionFormats.ShortenPaths | ExceptionFormats.ShortenTypes |
|
||||||
ExceptionFormat.ShortenMethods | ExceptionFormat.ShowLinks);
|
ExceptionFormats.ShortenMethods | ExceptionFormats.ShowLinks);
|
||||||
```
|
```
|
||||||
|
|
||||||
<img src="assets/images/compact_exception.png" style="max-width: 100%;">
|
<img src="assets/images/compact_exception.png" style="max-width: 100%;">
|
||||||
|
|
||||||
|
## Customizing exception output
|
||||||
|
|
||||||
|
In addition to shorten specific part of the exception, you can
|
||||||
|
also override the default styling.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
AnsiConsole.WriteException(ex, new ExceptionSettings
|
||||||
|
{
|
||||||
|
Format = ExceptionFormats.ShortenEverything | ExceptionFormats.ShowLinks,
|
||||||
|
Style = new ExceptionStyle
|
||||||
|
{
|
||||||
|
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),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
<img src="assets/images/custom_exception.png" style="max-width: 100%;">
|
||||||
|
|||||||
33
docs/input/figlet.md
Normal file
33
docs/input/figlet.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
Title: Figlet
|
||||||
|
Order: 5
|
||||||
|
---
|
||||||
|
|
||||||
|
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));
|
||||||
|
```
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
Title: Welcome
|
Title: Welcome
|
||||||
Order: 0
|
Order: 0
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ for Python written by Will McGugan.
|
|||||||
The library will detect the capabilities of the current terminal
|
The library will detect the capabilities of the current terminal
|
||||||
and downgrade colors as needed.
|
and downgrade colors as needed.
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
<img width="100%"
|
<img src="assets/images/table.gif" style="max-width: 100%; margin-top: 15px; margin-bottom: 25px;" />
|
||||||
src="https://github.com/spectresystems/spectre.console/raw/main/resources/gfx/screenshots/example.png" />
|
<img src="https://github.com/spectresystems/spectre.console/raw/main/resources/gfx/screenshots/example.png" style="max-width: 100%;" />
|
||||||
@@ -6,7 +6,7 @@ The class `Markup` allows you to output rich text to the console.
|
|||||||
|
|
||||||
# Syntax
|
# 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 `[/]`.
|
in square brackets, e.g. `[bold red]`, that style will apply until it is closed with a `[/]`.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
@@ -21,6 +21,7 @@ rendering of `IRenderable` also have overloads for rendering rich text.
|
|||||||
var table = new Table();
|
var table = new Table();
|
||||||
table.AddColumn(new TableColumn(new Markup("[yellow]Foo[/]")));
|
table.AddColumn(new TableColumn(new Markup("[yellow]Foo[/]")));
|
||||||
table.AddColumn(new TableColumn("[blue]Bar[/]"));
|
table.AddColumn(new TableColumn("[blue]Bar[/]"));
|
||||||
|
AnsiConsole.Render(table);
|
||||||
```
|
```
|
||||||
|
|
||||||
# Convenience methods
|
# Convenience methods
|
||||||
@@ -43,14 +44,24 @@ AnsiConsole.Markup("[[Hello]] "); // [Hello]
|
|||||||
AnsiConsole.Markup("[red][[World]][/]"); // [World]
|
AnsiConsole.Markup("[red][[World]][/]"); // [World]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can also use the `EscapeMarkup` extension method.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
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
|
# Setting background color
|
||||||
|
|
||||||
You can set the background color in markup by prefixing the color with
|
You can set the background color in markup by prefixing the color with
|
||||||
`on`.
|
`on`.
|
||||||
|
|
||||||
```
|
```csharp
|
||||||
[bold yellow on blue]Hello[/]
|
AnsiConsole.Markup("[bold yellow on blue]Hello[/]");
|
||||||
[default on blue]World[/]
|
AnsiConsole.Markup("[default on blue]World[/]");
|
||||||
```
|
```
|
||||||
|
|
||||||
# Rendering emojis
|
# Rendering emojis
|
||||||
@@ -58,10 +69,10 @@ 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.
|
To output an emoji as part of markup, you can use emoji shortcodes.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
AnsiConsole.MarkupLine("Hello :globe_showing_europe_africa:!");
|
AnsiConsole.Markup("Hello :globe_showing_europe_africa:!");
|
||||||
```
|
```
|
||||||
|
|
||||||
For a list of emoji, see the [Emojis](xref:styles) appendix section.
|
For a list of emoji, see the [Emojis](xref:emojis) appendix section.
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
|
|
||||||
|
|||||||
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? _
|
||||||
|
```
|
||||||
121
docs/input/widgets/calendar.md
Normal file
121
docs/input/widgets/calendar.md
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
Title: Calendar
|
||||||
|
Order: 4
|
||||||
|
RedirectFrom: calendar
|
||||||
|
---
|
||||||
|
|
||||||
|
The `Calendar` is used to render a calendar to the terminal.
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
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 │
|
||||||
|
├─────┼─────┼─────┼─────┼─────┼─────┼─────┤
|
||||||
|
│ │ │ │ │ 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 │
|
||||||
|
│ │ │ │ │ │ │ │
|
||||||
|
└─────┴─────┴─────┴─────┴─────┴─────┴─────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
## Culture
|
||||||
|
|
||||||
|
You can set the calendar's culture to show localized weekdays.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var calendar = new Calendar(2020,10);
|
||||||
|
calendar.Culture("ja-JP");
|
||||||
|
AnsiConsole.Render(calendar);
|
||||||
|
```
|
||||||
|
|
||||||
|
```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
|
||||||
|
|
||||||
|
You can hide the calendar header.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var calendar = new Calendar(2020,10);
|
||||||
|
calendar.ShowHeader();
|
||||||
|
AnsiConsole.Render(calendar);
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||||
|
│ 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 │
|
||||||
|
│ │ │ │ │ │ │ │
|
||||||
|
└─────┴─────┴─────┴─────┴─────┴─────┴─────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
You can set the header style of the calendar.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var calendar = new Calendar(2020, 10);
|
||||||
|
calendar.HeaderStyle(Style.Parse("blue bold"));
|
||||||
|
AnsiConsole.Render(calendar);
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var calendar = new Calendar(2020,10);
|
||||||
|
calendar.AddCalendarEvent(2020, 10, 11);
|
||||||
|
AnsiConsole.Render(calendar);
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
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 │
|
||||||
|
│ │ │ │ │ │ │ │
|
||||||
|
└─────┴─────┴─────┴─────┴─────┴─────┴─────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
### Highlight style
|
||||||
|
|
||||||
|
You can set the highlight style for a calendar event via `SetHighlightStyle`.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var calendar = new Calendar(2020, 10);
|
||||||
|
calendar.AddCalendarEvent(2020, 10, 11);
|
||||||
|
calendar.HighlightStyle(Style.Parse("yellow bold"));
|
||||||
|
AnsiConsole.Render(calendar);
|
||||||
|
```
|
||||||
3
docs/input/widgets/index.md
Normal file
3
docs/input/widgets/index.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Title: Widgets
|
||||||
|
Order: 9
|
||||||
|
---
|
||||||
72
docs/input/widgets/rule.md
Normal file
72
docs/input/widgets/rule.md
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
Title: Rule
|
||||||
|
Order: 5
|
||||||
|
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
|
||||||
|
|
||||||
|
To render a rule without a title:
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var rule = new Rule();
|
||||||
|
AnsiConsole.Render(rule);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Title
|
||||||
|
|
||||||
|
You can set the rule title markup text.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var rule = new Rule("[red]Hello[/]");
|
||||||
|
AnsiConsole.Render(rule);
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
───────────────────────────────── Hello ─────────────────────────────────
|
||||||
|
```
|
||||||
|
|
||||||
|
### Title alignment
|
||||||
|
|
||||||
|
You can set the rule's title alignment.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var rule = new Rule("[red]Hello[/]");
|
||||||
|
rule.Alignment = Justify.Left;
|
||||||
|
AnsiConsole.Render(rule);
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
── Hello ────────────────────────────────────────────────────────────────
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also specify it via an extension method:
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var rule = new Rule("[red]Hello[/]");
|
||||||
|
rule.LeftAligned();
|
||||||
|
AnsiConsole.Render(rule);
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
── Hello ────────────────────────────────────────────────────────────────
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Styling
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var rule = new Rule("[red]Hello[/]");
|
||||||
|
rule.Style = Style.Parse("red dim");
|
||||||
|
AnsiConsole.Render(rule);
|
||||||
|
```
|
||||||
|
You can also specify it via an extension method
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var rule = new Rule("[red]Hello[/]");
|
||||||
|
rule.RuleStyle("red dim");
|
||||||
|
AnsiConsole.Render(rule);
|
||||||
|
```
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
Title: Tables
|
Title: Table
|
||||||
Order: 3
|
Order: 3
|
||||||
|
RedirectFrom: tables
|
||||||
---
|
---
|
||||||
|
|
||||||
Tables are a perfect way of displaying tabular data in a terminal.
|
Tables are a perfect way of displaying tabular data in a terminal.
|
||||||
@@ -36,7 +37,7 @@ AnsiConsole.Render(table);
|
|||||||
|
|
||||||
This will render the following output:
|
This will render the following output:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
# Table appearance
|
# Table appearance
|
||||||
|
|
||||||
@@ -50,10 +51,10 @@ For a list of borders, see the [Borders](xref:borders) appendix section.
|
|||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
// Sets the border
|
// Sets the border
|
||||||
table.SetBorder(Border.None);
|
table.Border(TableBorder.None);
|
||||||
table.SetBorder(Border.Ascii);
|
table.Border(TableBorder.Ascii);
|
||||||
table.SetBorder(Border.Square);
|
table.Border(TableBorder.Square);
|
||||||
table.SetBorder(Border.Rounded);
|
table.Border(TableBorder.Rounded);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Expand / Collapse
|
## Expand / Collapse
|
||||||
@@ -78,7 +79,16 @@ table.HideHeaders();
|
|||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
// Sets the table width to 50 cells
|
// 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
|
# Column appearance
|
||||||
@@ -90,31 +100,37 @@ table.SetWidth(50);
|
|||||||
## Alignment
|
## Alignment
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
// Set the alignment explicitly
|
table.Columns[0].Alignment(Justify.Right);
|
||||||
column.SetAlignment(Justify.Right);
|
table.Columns[0].LeftAligned();
|
||||||
|
table.Columns[0].Centered();
|
||||||
|
table.Columns[0].RightAligned();
|
||||||
```
|
```
|
||||||
|
|
||||||
## Padding
|
## Padding
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
// Set left and right padding
|
// Set padding individually
|
||||||
column.SetPadding(left: 3, right: 5);
|
table.Columns[0].PadLeft(3);
|
||||||
|
table.Columns[0].PadRight(5);
|
||||||
|
|
||||||
// Set padding individually.
|
// Or chained together
|
||||||
column.PadLeft(3);
|
table.Columns[0].PadLeft(3).PadRight(5);
|
||||||
column.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
|
## Disable column wrapping
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
// Disable column wrapping
|
// Disable column wrapping
|
||||||
column.NoWrap();
|
table.Columns[0].NoWrap();
|
||||||
```
|
```
|
||||||
|
|
||||||
## Set column width
|
## Set column width
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
// Set the column width (no fluent extension method for this yet)
|
// Set the column width
|
||||||
column.Width = 15;
|
table.Columns[0].Width(15);
|
||||||
```
|
```
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
"isRoot": true,
|
"isRoot": true,
|
||||||
"tools": {
|
"tools": {
|
||||||
"cake.tool": {
|
"cake.tool": {
|
||||||
"version": "0.38.4",
|
"version": "1.0.0-rc0001",
|
||||||
"commands": [
|
"commands": [
|
||||||
"dotnet-cake"
|
"dotnet-cake"
|
||||||
]
|
]
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dotnet-example": {
|
"dotnet-example": {
|
||||||
"version": "0.8.0",
|
"version": "1.1.0",
|
||||||
"commands": [
|
"commands": [
|
||||||
"dotnet-example"
|
"dotnet-example"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<Title>Borders</Title>
|
<Title>Borders</Title>
|
||||||
<Description>Demonstrates the different kind of borders.</Description>
|
<Description>Demonstrates the different kind of borders.</Description>
|
||||||
|
|||||||
@@ -8,26 +8,22 @@ namespace BordersExample
|
|||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
// Render panel borders
|
// Render panel borders
|
||||||
AnsiConsole.WriteLine();
|
HorizontalRule("PANEL BORDERS");
|
||||||
AnsiConsole.MarkupLine("[white bold underline]PANEL BORDERS[/]");
|
PanelBorders();
|
||||||
AnsiConsole.WriteLine();
|
|
||||||
RenderPanelBorders();
|
|
||||||
|
|
||||||
// Render table borders
|
// Render table borders
|
||||||
AnsiConsole.WriteLine();
|
HorizontalRule("TABLE BORDERS");
|
||||||
AnsiConsole.MarkupLine("[white bold underline]TABLE BORDERS[/]");
|
TableBorders();
|
||||||
AnsiConsole.WriteLine();
|
|
||||||
RenderTableBorders();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RenderPanelBorders()
|
private static void PanelBorders()
|
||||||
{
|
{
|
||||||
static IRenderable CreatePanel(string name, BoxBorder border)
|
static IRenderable CreatePanel(string name, BoxBorder border)
|
||||||
{
|
{
|
||||||
return new Panel($"This is a panel with\nthe [yellow]{name}[/] border.")
|
return new Panel($"This is a panel with\nthe [yellow]{name}[/] border.")
|
||||||
.SetHeader($" {name} ", Style.Parse("blue"), Justify.Center)
|
.Header($" [blue]{name}[/] ", Justify.Center)
|
||||||
.SetBorderStyle(Style.Parse("grey"))
|
.Border(border)
|
||||||
.SetBorder(border);
|
.BorderStyle(Style.Parse("grey"));
|
||||||
}
|
}
|
||||||
|
|
||||||
var items = new[]
|
var items = new[]
|
||||||
@@ -46,19 +42,18 @@ namespace BordersExample
|
|||||||
new Padding(2,0,0,0)));
|
new Padding(2,0,0,0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RenderTableBorders()
|
private static void TableBorders()
|
||||||
{
|
{
|
||||||
static IRenderable CreateTable(string name, TableBorder border)
|
static IRenderable CreateTable(string name, TableBorder border)
|
||||||
{
|
{
|
||||||
var table = new Table().SetBorder(border);
|
var table = new Table().Border(border);
|
||||||
table.AddColumn("[yellow]Header 1[/]");
|
table.AddColumn("[yellow]Header 1[/]", c => c.Footer("[grey]Footer 1[/]"));
|
||||||
table.AddColumn("[yellow]Header 2[/]", col => col.RightAligned());
|
table.AddColumn("[yellow]Header 2[/]", col => col.Footer("[grey]Footer 2[/]").RightAligned());
|
||||||
table.AddRow("Cell", "Cell");
|
table.AddRow("Cell", "Cell");
|
||||||
table.AddRow("Cell", "Cell");
|
table.AddRow("Cell", "Cell");
|
||||||
|
|
||||||
return new Panel(table)
|
return new Panel(table)
|
||||||
.SetHeader($" {name} ", Style.Parse("blue"), Justify.Center)
|
.Header($" [blue]{name}[/] ", Justify.Center)
|
||||||
.SetBorderStyle(Style.Parse("grey"))
|
|
||||||
.NoBorder();
|
.NoBorder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,5 +80,12 @@ namespace BordersExample
|
|||||||
|
|
||||||
AnsiConsole.Render(new Columns(items).Collapse());
|
AnsiConsole.Render(new Columns(items).Collapse());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void HorizontalRule(string title)
|
||||||
|
{
|
||||||
|
AnsiConsole.WriteLine();
|
||||||
|
AnsiConsole.Render(new Rule($"[white bold]{title}[/]").RuleStyle("grey").LeftAligned());
|
||||||
|
AnsiConsole.WriteLine();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
examples/Calendars/Calendars.csproj
Normal file
15
examples/Calendars/Calendars.csproj
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
<Title>Calendars</Title>
|
||||||
|
<Description>Demonstrates how to render calendars.</Description>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Spectre.Console\Spectre.Console.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
19
examples/Calendars/Program.cs
Normal file
19
examples/Calendars/Program.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using Spectre.Console;
|
||||||
|
|
||||||
|
namespace Calendars
|
||||||
|
{
|
||||||
|
public static class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
AnsiConsole.WriteLine();
|
||||||
|
AnsiConsole.Render(new Calendar(2020, 10)
|
||||||
|
.RoundedBorder()
|
||||||
|
.HighlightStyle(Style.Parse("red"))
|
||||||
|
.HeaderStyle(Style.Parse("yellow"))
|
||||||
|
.AddCalendarEvent("An event", 2020, 9, 22)
|
||||||
|
.AddCalendarEvent("Another event", 2020, 10, 2)
|
||||||
|
.AddCalendarEvent("A third event", 2020, 10, 13));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<Title>Colors</Title>
|
<Title>Colors</Title>
|
||||||
<Description>Demonstrates how to use [yellow]c[/][red]o[/][green]l[/][blue]o[/][aqua]r[/][lime]s[/] in the console.</Description>
|
<Description>Demonstrates how to use [yellow]c[/][red]o[/][green]l[/][blue]o[/][aqua]r[/][lime]s[/] in the console.</Description>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace ColorExample
|
|||||||
|
|
||||||
AnsiConsole.ResetColors();
|
AnsiConsole.ResetColors();
|
||||||
AnsiConsole.WriteLine();
|
AnsiConsole.WriteLine();
|
||||||
AnsiConsole.MarkupLine("[bold underline]3-bit Colors[/]");
|
AnsiConsole.Render(new Rule("[yellow bold underline]3-bit Colors[/]").RuleStyle("grey").LeftAligned());
|
||||||
AnsiConsole.WriteLine();
|
AnsiConsole.WriteLine();
|
||||||
|
|
||||||
for (var i = 0; i < 8; i++)
|
for (var i = 0; i < 8; i++)
|
||||||
@@ -47,7 +47,7 @@ namespace ColorExample
|
|||||||
|
|
||||||
AnsiConsole.ResetColors();
|
AnsiConsole.ResetColors();
|
||||||
AnsiConsole.WriteLine();
|
AnsiConsole.WriteLine();
|
||||||
AnsiConsole.MarkupLine("[bold underline]4-bit Colors[/]");
|
AnsiConsole.Render(new Rule("[yellow bold underline]4-bit Colors[/]").RuleStyle("grey").LeftAligned());
|
||||||
AnsiConsole.WriteLine();
|
AnsiConsole.WriteLine();
|
||||||
|
|
||||||
for (var i = 0; i < 16; i++)
|
for (var i = 0; i < 16; i++)
|
||||||
@@ -70,7 +70,7 @@ namespace ColorExample
|
|||||||
|
|
||||||
AnsiConsole.ResetColors();
|
AnsiConsole.ResetColors();
|
||||||
AnsiConsole.WriteLine();
|
AnsiConsole.WriteLine();
|
||||||
AnsiConsole.MarkupLine("[bold underline]8-bit Colors[/]");
|
AnsiConsole.Render(new Rule("[yellow bold underline]8-bit Colors[/]").RuleStyle("grey").LeftAligned());
|
||||||
AnsiConsole.WriteLine();
|
AnsiConsole.WriteLine();
|
||||||
|
|
||||||
for (var i = 0; i < 16; i++)
|
for (var i = 0; i < 16; i++)
|
||||||
@@ -97,7 +97,7 @@ namespace ColorExample
|
|||||||
|
|
||||||
AnsiConsole.ResetColors();
|
AnsiConsole.ResetColors();
|
||||||
AnsiConsole.WriteLine();
|
AnsiConsole.WriteLine();
|
||||||
AnsiConsole.MarkupLine("[bold underline]24-bit Colors[/]");
|
AnsiConsole.Render(new Rule("[yellow bold underline]24-bit Colors[/]").RuleStyle("grey").LeftAligned());
|
||||||
AnsiConsole.WriteLine();
|
AnsiConsole.WriteLine();
|
||||||
|
|
||||||
var index = 0;
|
var index = 0;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<Title>Columns</Title>
|
<Title>Columns</Title>
|
||||||
<Description>Demonstrates how to render data into columns.</Description>
|
<Description>Demonstrates how to render data into columns.</Description>
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ namespace ColumnsExample
|
|||||||
var cards = new List<Panel>();
|
var cards = new List<Panel>();
|
||||||
foreach(var user in users.results)
|
foreach(var user in users.results)
|
||||||
{
|
{
|
||||||
cards.Add(new Panel(GetCard(user))
|
cards.Add(new Panel(GetCardContent(user))
|
||||||
.SetHeader($"{user.location.country}")
|
.Header($"{user.location.country}")
|
||||||
.RoundedBorder().Expand());
|
.RoundedBorder().Expand());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ namespace ColumnsExample
|
|||||||
AnsiConsole.Render(new Columns(cards));
|
AnsiConsole.Render(new Columns(cards));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetCard(dynamic user)
|
private static string GetCardContent(dynamic user)
|
||||||
{
|
{
|
||||||
var name = $"{user.name.first} {user.name.last}";
|
var name = $"{user.name.first} {user.name.last}";
|
||||||
var country = $"{user.location.city}";
|
var country = $"{user.location.city}";
|
||||||
|
|||||||
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>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<Title>Emojis</Title>
|
<Title>Emojis</Title>
|
||||||
<Description>Demonstrates how to render emojis.</Description>
|
<Description>Demonstrates how to render emojis.</Description>
|
||||||
|
|||||||
@@ -6,11 +6,19 @@ namespace EmojiExample
|
|||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
// Markup
|
// Show a known emoji
|
||||||
|
RenderEmoji();
|
||||||
|
|
||||||
|
// Show a remapped emoji
|
||||||
|
Emoji.Remap("globe_showing_europe_africa", Emoji.Known.GrinningFaceWithSmilingEyes);
|
||||||
|
RenderEmoji();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void RenderEmoji()
|
||||||
|
{
|
||||||
AnsiConsole.Render(
|
AnsiConsole.Render(
|
||||||
new Panel("[yellow]Hello :globe_showing_europe_africa:![/]")
|
new Panel("[yellow]Hello :globe_showing_europe_africa:![/]")
|
||||||
.RoundedBorder()
|
.RoundedBorder());
|
||||||
.SetHeader("Markup"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<Title>Exceptions</Title>
|
<Title>Exceptions</Title>
|
||||||
<Description>Demonstrates how to render formatted exceptions.</Description>
|
<Description>Demonstrates how to render formatted exceptions.</Description>
|
||||||
|
|||||||
@@ -14,11 +14,35 @@ namespace Exceptions
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
AnsiConsole.WriteLine();
|
||||||
|
AnsiConsole.Render(new Rule("Default").LeftAligned());
|
||||||
AnsiConsole.WriteLine();
|
AnsiConsole.WriteLine();
|
||||||
AnsiConsole.WriteException(ex);
|
AnsiConsole.WriteException(ex);
|
||||||
|
|
||||||
|
AnsiConsole.WriteLine();
|
||||||
|
AnsiConsole.Render(new Rule("Compact").LeftAligned());
|
||||||
AnsiConsole.WriteLine();
|
AnsiConsole.WriteLine();
|
||||||
AnsiConsole.WriteException(ex, ExceptionFormats.ShortenEverything | ExceptionFormats.ShowLinks);
|
AnsiConsole.WriteException(ex, ExceptionFormats.ShortenEverything | ExceptionFormats.ShowLinks);
|
||||||
|
|
||||||
|
AnsiConsole.WriteLine();
|
||||||
|
AnsiConsole.Render(new Rule("Compact + Custom colors").LeftAligned());
|
||||||
|
AnsiConsole.WriteLine();
|
||||||
|
AnsiConsole.WriteException(ex, new ExceptionSettings
|
||||||
|
{
|
||||||
|
Format = ExceptionFormats.ShortenEverything | ExceptionFormats.ShowLinks,
|
||||||
|
Style = new ExceptionStyle
|
||||||
|
{
|
||||||
|
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),
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
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>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<Title>Grids</Title>
|
<Title>Grids</Title>
|
||||||
<Description>Demonstrates how to render grids in a console.</Description>
|
<Description>Demonstrates how to render grids in a console.</Description>
|
||||||
|
|||||||
@@ -11,13 +11,12 @@ namespace GridExample
|
|||||||
AnsiConsole.WriteLine();
|
AnsiConsole.WriteLine();
|
||||||
|
|
||||||
var grid = new Grid();
|
var grid = new Grid();
|
||||||
grid.AddColumn(new GridColumn { NoWrap = true });
|
grid.AddColumn(new GridColumn().NoWrap());
|
||||||
grid.AddColumn(new GridColumn { NoWrap = true, Width = 2 });
|
grid.AddColumn(new GridColumn().PadLeft(2));
|
||||||
grid.AddColumn();
|
grid.AddRow("Options:");
|
||||||
grid.AddRow("Options:", "", "");
|
grid.AddRow(" [blue]-h[/], [blue]--help[/]", "Show command line help.");
|
||||||
grid.AddRow(" [blue]-h[/], [blue]--help[/]", "", "Show command line help.");
|
grid.AddRow(" [blue]-c[/], [blue]--configuration[/] <CONFIGURATION>", "The configuration to run for.");
|
||||||
grid.AddRow(" [blue]-c[/], [blue]--configuration[/] <CONFIGURATION>", "", "The configuration to run for.");
|
grid.AddRow(" [blue]-v[/], [blue]--verbosity[/] <LEVEL>", "Set the [grey]MSBuild[/] verbosity level.");
|
||||||
grid.AddRow(" [blue]-v[/], [blue]--verbosity[/] <LEVEL>", "", "Set the [grey]MSBuild[/] verbosity level.");
|
|
||||||
|
|
||||||
AnsiConsole.Render(grid);
|
AnsiConsole.Render(grid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<Title>Info</Title>
|
<Title>Info</Title>
|
||||||
<Description>Displays the capabilities of the current console.</Description>
|
<Description>Displays the capabilities of the current console.</Description>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using Spectre.Console;
|
using Spectre.Console;
|
||||||
|
|
||||||
namespace InfoExample
|
namespace InfoExample
|
||||||
@@ -12,12 +13,13 @@ namespace InfoExample
|
|||||||
.AddRow("[b]Color system[/]", $"{AnsiConsole.Capabilities.ColorSystem}")
|
.AddRow("[b]Color system[/]", $"{AnsiConsole.Capabilities.ColorSystem}")
|
||||||
.AddRow("[b]Supports ansi?[/]", $"{YesNo(AnsiConsole.Capabilities.SupportsAnsi)}")
|
.AddRow("[b]Supports ansi?[/]", $"{YesNo(AnsiConsole.Capabilities.SupportsAnsi)}")
|
||||||
.AddRow("[b]Legacy console?[/]", $"{YesNo(AnsiConsole.Capabilities.LegacyConsole)}")
|
.AddRow("[b]Legacy console?[/]", $"{YesNo(AnsiConsole.Capabilities.LegacyConsole)}")
|
||||||
|
.AddRow("[b]Interactive?[/]", $"{YesNo(Environment.UserInteractive)}")
|
||||||
.AddRow("[b]Buffer width[/]", $"{AnsiConsole.Console.Width}")
|
.AddRow("[b]Buffer width[/]", $"{AnsiConsole.Console.Width}")
|
||||||
.AddRow("[b]Buffer height[/]", $"{AnsiConsole.Console.Height}");
|
.AddRow("[b]Buffer height[/]", $"{AnsiConsole.Console.Height}");
|
||||||
|
|
||||||
AnsiConsole.Render(
|
AnsiConsole.Render(
|
||||||
new Panel(grid)
|
new Panel(grid)
|
||||||
.SetHeader("Information"));
|
.Header("Information"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string YesNo(bool value)
|
private static string YesNo(bool value)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<Title>Links</Title>
|
<Title>Links</Title>
|
||||||
<Description>Demonstrates how to render links in a console.</Description>
|
<Description>Demonstrates how to render links in a console.</Description>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<Title>Panels</Title>
|
<Title>Panels</Title>
|
||||||
<Description>Demonstrates how to render items in panels.</Description>
|
<Description>Demonstrates how to render items in panels.</Description>
|
||||||
|
|||||||
@@ -13,28 +13,30 @@ namespace PanelExample
|
|||||||
AnsiConsole.Render(
|
AnsiConsole.Render(
|
||||||
new Panel(
|
new Panel(
|
||||||
new Panel(content)
|
new Panel(content)
|
||||||
.SetBorder(BoxBorder.Rounded)));
|
.Border(BoxBorder.Rounded)));
|
||||||
|
|
||||||
// Left adjusted panel with text
|
// Left adjusted panel with text
|
||||||
AnsiConsole.Render(
|
AnsiConsole.Render(
|
||||||
new Panel(new Text("Left adjusted\nLeft").LeftAligned())
|
new Panel(new Text("Left adjusted\nLeft").LeftAligned())
|
||||||
.Expand()
|
.Expand()
|
||||||
.SquareBorder()
|
.SquareBorder()
|
||||||
.SetHeader("Left", Style.WithForeground(Color.Red)));
|
.Header("[red]Left[/]"));
|
||||||
|
|
||||||
// Centered ASCII panel with text
|
// Centered ASCII panel with text
|
||||||
AnsiConsole.Render(
|
AnsiConsole.Render(
|
||||||
new Panel(new Text("Centered\nCenter").Centered())
|
new Panel(new Text("Centered\nCenter").Centered())
|
||||||
.Expand()
|
.Expand()
|
||||||
.AsciiBorder()
|
.AsciiBorder()
|
||||||
.SetHeader("Center", Style.WithForeground(Color.Green), Justify.Center));
|
.Header("[green]Center[/]")
|
||||||
|
.HeaderAlignment(Justify.Center));
|
||||||
|
|
||||||
// Right adjusted, rounded panel with text
|
// Right adjusted, rounded panel with text
|
||||||
AnsiConsole.Render(
|
AnsiConsole.Render(
|
||||||
new Panel(new Text("Right adjusted\nRight").RightAligned())
|
new Panel(new Text("Right adjusted\nRight").RightAligned())
|
||||||
.Expand()
|
.Expand()
|
||||||
.RoundedBorder()
|
.RoundedBorder()
|
||||||
.SetHeader("Right", Style.WithForeground(Color.Blue), Justify.Right));
|
.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>
|
||||||
43
examples/Rules/Program.cs
Normal file
43
examples/Rules/Program.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
using Spectre.Console;
|
||||||
|
|
||||||
|
namespace EmojiExample
|
||||||
|
{
|
||||||
|
public static class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
// No title
|
||||||
|
WrapInPanel(
|
||||||
|
new Rule()
|
||||||
|
.RuleStyle(Style.Parse("yellow"))
|
||||||
|
.AsciiBorder()
|
||||||
|
.LeftAligned());
|
||||||
|
|
||||||
|
// Left aligned title
|
||||||
|
WrapInPanel(
|
||||||
|
new Rule("[blue]Left aligned[/]")
|
||||||
|
.RuleStyle(Style.Parse("red"))
|
||||||
|
.DoubleBorder()
|
||||||
|
.LeftAligned());
|
||||||
|
|
||||||
|
// Centered title
|
||||||
|
WrapInPanel(
|
||||||
|
new Rule("[green]Centered[/]")
|
||||||
|
.RuleStyle(Style.Parse("green"))
|
||||||
|
.HeavyBorder()
|
||||||
|
.Centered());
|
||||||
|
|
||||||
|
// Right aligned title
|
||||||
|
WrapInPanel(
|
||||||
|
new Rule("[red]Right aligned[/]")
|
||||||
|
.RuleStyle(Style.Parse("blue"))
|
||||||
|
.RightAligned());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void WrapInPanel(Rule rule)
|
||||||
|
{
|
||||||
|
AnsiConsole.Render(rule);
|
||||||
|
AnsiConsole.WriteLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
examples/Rules/Rules.csproj
Normal file
15
examples/Rules/Rules.csproj
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
<Title>Rules</Title>
|
||||||
|
<Description>Demonstrates how to render horizontal rules (lines).</Description>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Spectre.Console\Spectre.Console.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -5,86 +5,47 @@ namespace TableExample
|
|||||||
public static class Program
|
public static class Program
|
||||||
{
|
{
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
|
||||||
// A simple table
|
|
||||||
RenderSimpleTable();
|
|
||||||
|
|
||||||
// A big table
|
|
||||||
RenderBigTable();
|
|
||||||
|
|
||||||
// A nested table
|
|
||||||
RenderNestedTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void RenderSimpleTable()
|
|
||||||
{
|
{
|
||||||
// Create the table.
|
// Create the table.
|
||||||
var table = new Table();
|
var table = CreateTable();
|
||||||
table.AddColumn(new TableColumn("[u]Foo[/]"));
|
|
||||||
table.AddColumn(new TableColumn("[u]Bar[/]"));
|
|
||||||
table.AddColumn(new TableColumn("[u]Baz[/]"));
|
|
||||||
|
|
||||||
// Add some rows
|
|
||||||
table.AddRow("Hello", "[red]World![/]", "");
|
|
||||||
table.AddRow("[blue]Bonjour[/]", "[white]le[/]", "[red]monde![/]");
|
|
||||||
table.AddRow("[blue]Hej[/]", "[yellow]Världen![/]", "");
|
|
||||||
|
|
||||||
|
// Render the table.
|
||||||
AnsiConsole.Render(table);
|
AnsiConsole.Render(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RenderBigTable()
|
private static Table CreateTable()
|
||||||
{
|
{
|
||||||
// Create the table.
|
var simple = new Table()
|
||||||
var table = new Table().SetBorder(TableBorder.Rounded);
|
.Border(TableBorder.Square)
|
||||||
table.AddColumn("[red underline]Foo[/]");
|
.BorderColor(Color.Red)
|
||||||
table.AddColumn(new TableColumn("[blue]Bar[/]") { Alignment = Justify.Right, NoWrap = true });
|
.AddColumn(new TableColumn("[u]CDE[/]").Footer("EDC").Centered())
|
||||||
|
.AddColumn(new TableColumn("[u]FED[/]").Footer("DEF"))
|
||||||
|
.AddColumn(new TableColumn("[u]IHG[/]").Footer("GHI"))
|
||||||
|
.AddRow("Hello", "[red]World![/]", "")
|
||||||
|
.AddRow("[blue]Bonjour[/]", "[white]le[/]", "[red]monde![/]")
|
||||||
|
.AddRow("[blue]Hej[/]", "[yellow]Världen![/]", "");
|
||||||
|
|
||||||
// Add some rows
|
var second = new Table()
|
||||||
table.AddRow("[blue][underline]Hell[/]o[/]", "World");
|
.Border(TableBorder.Rounded)
|
||||||
table.AddRow("[yellow]Patrik [green]\"Hello World\"[/] Svensson[/]", "Was [underline]here[/]!");
|
.BorderColor(Color.Green)
|
||||||
table.AddEmptyRow();
|
.AddColumn(new TableColumn("[u]Foo[/]"))
|
||||||
table.AddRow(
|
.AddColumn(new TableColumn("[u]Bar[/]"))
|
||||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit,sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " +
|
.AddColumn(new TableColumn("[u]Baz[/]"))
|
||||||
"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure " +
|
.AddRow("Hello", "[red]World![/]", "")
|
||||||
"dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat " +
|
.AddRow(simple, new Text("Whaaat"), new Text("Lolz"))
|
||||||
"non proident, sunt in culpa qui officia deserunt mollit anim id est laborum", "<- Strange language");
|
.AddRow("[blue]Hej[/]", "[yellow]Världen![/]", "");
|
||||||
table.AddEmptyRow();
|
|
||||||
table.AddRow("Hej", "[green]Världen[/]");
|
|
||||||
|
|
||||||
AnsiConsole.Render(table);
|
return new Table()
|
||||||
}
|
.Centered()
|
||||||
|
.Border(TableBorder.DoubleEdge)
|
||||||
private static void RenderNestedTable()
|
.Title("TABLE [yellow]TITLE[/]")
|
||||||
{
|
.Caption("TABLE [yellow]CAPTION[/]")
|
||||||
// Create simple table.
|
.AddColumn(new TableColumn(new Panel("[u]ABC[/]").BorderColor(Color.Red)).Footer("[u]FOOTER 1[/]"))
|
||||||
var simple = new Table().SetBorder(TableBorder.Rounded).SetBorderColor(Color.Red);
|
.AddColumn(new TableColumn(new Panel("[u]DEF[/]").BorderColor(Color.Green)).Footer("[u]FOOTER 2[/]"))
|
||||||
simple.AddColumn(new TableColumn("[u]Foo[/]").Centered());
|
.AddColumn(new TableColumn(new Panel("[u]GHI[/]").BorderColor(Color.Blue)).Footer("[u]FOOTER 3[/]"))
|
||||||
simple.AddColumn(new TableColumn("[u]Bar[/]"));
|
.AddRow(new Text("Hello").Centered(), new Markup("[red]World![/]"), Text.Empty)
|
||||||
simple.AddColumn(new TableColumn("[u]Baz[/]"));
|
.AddRow(second, new Text("Whaaat"), new Text("Lol"))
|
||||||
simple.AddRow("Hello", "[red]World![/]", "");
|
.AddRow(new Markup("[blue]Hej[/]").Centered(), new Markup("[yellow]Världen![/]"), Text.Empty);
|
||||||
simple.AddRow("[blue]Bonjour[/]", "[white]le[/]", "[red]monde![/]");
|
|
||||||
simple.AddRow("[blue]Hej[/]", "[yellow]Världen![/]", "");
|
|
||||||
|
|
||||||
// Create other table.
|
|
||||||
var second = new Table().SetBorder(TableBorder.Square).SetBorderColor(Color.Green);
|
|
||||||
second.AddColumn(new TableColumn("[u]Foo[/]"));
|
|
||||||
second.AddColumn(new TableColumn("[u]Bar[/]"));
|
|
||||||
second.AddColumn(new TableColumn("[u]Baz[/]"));
|
|
||||||
second.AddRow("Hello", "[red]World![/]", "");
|
|
||||||
second.AddRow(simple, new Text("Whaaat"), new Text("Lolz"));
|
|
||||||
second.AddRow("[blue]Hej[/]", "[yellow]Världen![/]", "");
|
|
||||||
|
|
||||||
var table = new Table().SetBorder(TableBorder.Rounded);
|
|
||||||
table.AddColumn(new TableColumn(new Panel("[u]Foo[/]").SetBorderColor(Color.Red)));
|
|
||||||
table.AddColumn(new TableColumn(new Panel("[u]Bar[/]").SetBorderColor(Color.Green)));
|
|
||||||
table.AddColumn(new TableColumn(new Panel("[u]Baz[/]").SetBorderColor(Color.Blue)));
|
|
||||||
|
|
||||||
// Add some rows
|
|
||||||
table.AddRow(new Text("Hello").Centered(), new Markup("[red]World![/]"), Text.Empty);
|
|
||||||
table.AddRow(second, new Text("Whaaat"), new Text("Lol"));
|
|
||||||
table.AddRow(new Markup("[blue]Hej[/]").Centered(), new Markup("[yellow]Världen![/]"), Text.Empty);
|
|
||||||
|
|
||||||
AnsiConsole.Render(table);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<Title>Tables</Title>
|
<Title>Tables</Title>
|
||||||
<Description>Demonstrates how to render tables in a console.</Description>
|
<Description>Demonstrates how to render tables in a console.</Description>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"projects": [ "src" ],
|
"projects": [ "src" ],
|
||||||
"sdk": {
|
"sdk": {
|
||||||
"version": "3.1.301",
|
"version": "5.0.100",
|
||||||
"rollForward": "latestPatch"
|
"rollForward": "latestPatch"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,4 +86,7 @@ dotnet_diagnostic.RCS1057.severity = none
|
|||||||
dotnet_diagnostic.RCS1227.severity = none
|
dotnet_diagnostic.RCS1227.severity = none
|
||||||
|
|
||||||
# IDE0004: Remove Unnecessary Cast
|
# IDE0004: Remove Unnecessary Cast
|
||||||
dotnet_diagnostic.IDE0004.severity = warning
|
dotnet_diagnostic.IDE0004.severity = warning
|
||||||
|
|
||||||
|
# CA1810: Initialize reference type static fields inline
|
||||||
|
dotnet_diagnostic.CA1810.severity = none
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup Label="Settings">
|
<PropertyGroup Label="Settings">
|
||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
<LangVersion>8.0</LangVersion>
|
<LangVersion>9.0</LangVersion>
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>embedded</DebugType>
|
<DebugType>embedded</DebugType>
|
||||||
<MinVerSkip Condition="'$(Configuration)' == 'Debug'">true</MinVerSkip>
|
<MinVerSkip Condition="'$(Configuration)' == 'Debug'">true</MinVerSkip>
|
||||||
|
|||||||
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 @@
|
|||||||
|
.______ ___ .___________..______ __ __ ___ ____ __ ____ ___ _______. __ __ _______ .______ _______
|
||||||
|
| _ \ / \ | || _ \ | | | |/ / \ \ / \ / / / \ / | | | | | | ____|| _ \ | ____|
|
||||||
|
| |_) | / ^ \ `---| |----`| |_) | | | | ' / \ \/ \/ / / ^ \ | (----` | |__| | | |__ | |_) | | |__
|
||||||
|
| ___/ / /_\ \ | | | / | | | < \ / / /_\ \ \ \ | __ | | __| | / | __|
|
||||||
|
| | / _____ \ | | | |\ \----.| | | . \ \ /\ / / _____ \ .----) | | | | | | |____ | |\ \----.| |____
|
||||||
|
| _| /__/ \__\ |__| | _| `._____||__| |__|\__\ \__/ \__/ /__/ \__\ |_______/ |__| |__| |_______|| _| `._____||_______|
|
||||||
|
|
||||||
@@ -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 │
|
||||||
|
└──────────────────────────────────────────────────────────────────────────────┘
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
┌─Greeting─────────────────────────────────────────────────────────────────────┐
|
||||||
|
│ Hello World │
|
||||||
|
└──────────────────────────────────────────────────────────────────────────────┘
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
┌─Greeting─────────────────────────────────────────────────────────────────────┐
|
||||||
|
│ Hello World │
|
||||||
|
└──────────────────────────────────────────────────────────────────────────────┘
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
┌─────────────┐
|
||||||
|
│ Hello World │
|
||||||
|
│ Foo Bar │
|
||||||
|
└─────────────┘
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user