mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-10-25 15:19:23 +00:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af9f5ea97d | ||
|
|
e96a821ead | ||
|
|
506253bc34 | ||
|
|
90c2d988ab | ||
|
|
2bd1383cbe | ||
|
|
00a9ba325e | ||
|
|
540bc1307c | ||
|
|
a6618f762c | ||
|
|
638149f44b | ||
|
|
0d72b94f9c | ||
|
|
0d19ccd8a6 | ||
|
|
78d841e3dc | ||
|
|
d94dc2fcb2 | ||
|
|
9d985f0f0a | ||
|
|
3a7b8aa1d2 | ||
|
|
dc93edef15 | ||
|
|
b4cf7a76d3 | ||
|
|
45a051150f | ||
|
|
47ef9a685e | ||
|
|
8ca602b986 | ||
|
|
a11ae6a93d | ||
|
|
b13ff8ebcc | ||
|
|
90e6a1aa21 | ||
|
|
f3a82073d9 | ||
|
|
ff8fd9ed2a | ||
|
|
1eeb32c704 | ||
|
|
c32decfa55 | ||
|
|
564c7b8f4e | ||
|
|
5b2b4375a4 | ||
|
|
70bbc24911 | ||
|
|
36ca22ffac | ||
|
|
b600832e00 | ||
|
|
da1c471c18 | ||
|
|
b6b963c03c | ||
|
|
7e1fb43f21 | ||
|
|
47fde1875b | ||
|
|
eb85f5860e | ||
|
|
25a61bea91 | ||
|
|
bad6672d76 | ||
|
|
f614032c82 | ||
|
|
585f010b26 | ||
|
|
90b917c38c | ||
|
|
edbe9d6ebc | ||
|
|
90de1847d8 |
20
.github/renovate.json
vendored
Normal file
20
.github/renovate.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:base"
|
||||
],
|
||||
"dependencyDashboard": false,
|
||||
"commitMessagePrefix": "chore:",
|
||||
"labels": ["dependencies"],
|
||||
"npm": {
|
||||
"ignorePaths": [
|
||||
"**/node_modules/**",
|
||||
"**/bower_components/**",
|
||||
"docs/**"
|
||||
]
|
||||
},
|
||||
"ignorePaths": [
|
||||
"resources/scripts/**",
|
||||
"docs/**"
|
||||
]
|
||||
}
|
||||
24
.github/workflows/ci.yaml
vendored
24
.github/workflows/ci.yaml
vendored
@@ -1,3 +1,4 @@
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||
name: Continuous Integration
|
||||
on: pull_request
|
||||
|
||||
@@ -19,19 +20,15 @@ jobs:
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Setup .NET SDK
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: |
|
||||
5.0.301
|
||||
6.0.100
|
||||
uses: actions/setup-dotnet@v2
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: npm-${{ hashFiles('package-lock.json') }}
|
||||
@@ -47,7 +44,7 @@ jobs:
|
||||
dotnet run --configuration Release
|
||||
|
||||
- name: Archive doc generation
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: documentation-output
|
||||
path: docs/output/
|
||||
@@ -73,17 +70,12 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup .NET SDK
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: |
|
||||
3.1.402
|
||||
5.0.301
|
||||
6.0.100
|
||||
uses: actions/setup-dotnet@v2
|
||||
|
||||
- name: Integration Tests
|
||||
shell: bash
|
||||
@@ -99,7 +91,7 @@ jobs:
|
||||
|
||||
- name: Upload Verify Test Results
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: verify-test-results
|
||||
path: |
|
||||
|
||||
55
.github/workflows/docs.yaml
vendored
55
.github/workflows/docs.yaml
vendored
@@ -1,55 +0,0 @@
|
||||
name: Deploy Documentation
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- 'src/**'
|
||||
- 'test/**'
|
||||
- 'examples/**'
|
||||
- '.github/**'
|
||||
|
||||
jobs:
|
||||
|
||||
###################################################
|
||||
# DOCS
|
||||
###################################################
|
||||
|
||||
build:
|
||||
name: Deploy
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup .NET SDK
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: |
|
||||
5.0.301
|
||||
6.0.100
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: npm-${{ hashFiles('package-lock.json') }}
|
||||
restore-keys: npm-
|
||||
|
||||
- name: Publish
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NETLIFY_ACCESS_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
run: |
|
||||
cd docs
|
||||
dotnet tool restore
|
||||
dotnet run --configuration Release -- deploy
|
||||
94
.github/workflows/publish.yaml
vendored
94
.github/workflows/publish.yaml
vendored
@@ -1,3 +1,4 @@
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||
name: Publish
|
||||
|
||||
on:
|
||||
@@ -13,41 +14,16 @@ env:
|
||||
|
||||
jobs:
|
||||
|
||||
###################################################
|
||||
# DOCS
|
||||
###################################################
|
||||
|
||||
docs:
|
||||
name: Documentation
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Setup .NET SDK
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: |
|
||||
5.0.301
|
||||
6.0.100
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
cd docs
|
||||
dotnet tool restore
|
||||
dotnet run --configuration Release
|
||||
|
||||
###################################################
|
||||
# BUILD
|
||||
###################################################
|
||||
|
||||
build:
|
||||
name: Build
|
||||
needs: [docs]
|
||||
if: "!contains(github.event.head_commit.message, 'skip-ci') || startsWith(github.ref, 'refs/tags/')"
|
||||
if: |
|
||||
(!startsWith(github.event.head_commit.message, 'skip-ci')
|
||||
&& !startsWith(github.event.head_commit.message, 'chore:'))
|
||||
|| startsWith(github.ref, 'refs/tags/')
|
||||
strategy:
|
||||
matrix:
|
||||
kind: ['linux', 'windows', 'macOS']
|
||||
@@ -61,17 +37,12 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup .NET SDK
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: |
|
||||
3.1.402
|
||||
5.0.301
|
||||
6.0.100
|
||||
uses: actions/setup-dotnet@v2
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
@@ -79,28 +50,63 @@ jobs:
|
||||
dotnet tool restore
|
||||
dotnet cake
|
||||
|
||||
###################################################
|
||||
# DOCS
|
||||
###################################################
|
||||
|
||||
documentation:
|
||||
name: Publish Documentation
|
||||
needs: [build]
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup .NET SDK
|
||||
uses: actions/setup-dotnet@v2
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: npm-${{ hashFiles('package-lock.json') }}
|
||||
restore-keys: npm-
|
||||
|
||||
- name: Publish Documentation
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NETLIFY_ACCESS_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
run: |
|
||||
cd docs
|
||||
dotnet tool restore
|
||||
dotnet run --configuration Release -- deploy
|
||||
|
||||
###################################################
|
||||
# PUBLISH
|
||||
###################################################
|
||||
|
||||
publish:
|
||||
name: Publish
|
||||
name: Publish NuGet Packages
|
||||
needs: [build]
|
||||
if: "!contains(github.event.head_commit.message, 'skip-ci') || startsWith(github.ref, 'refs/tags/')"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup .NET SDK
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: |
|
||||
3.1.402
|
||||
5.0.301
|
||||
6.0.100
|
||||
uses: actions/setup-dotnet@v2
|
||||
|
||||
- name: Publish
|
||||
shell: bash
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
_[](https://www.nuget.org/packages/spectre.console)_
|
||||
|
||||
`Spectre.Console`是一个 .NET 5/.NET Standard 2.0 的库,能让您在终端里更方便地生成精美的界面。
|
||||
`Spectre.Console`是一个 .NET 5/.NET Standard 2.0 的库,可以更轻松地创建美观的跨平台控制台应用程序。
|
||||
|
||||
深受 [Rich](https://github.com/willmcgugan/rich) 这个Python优秀库的启发。
|
||||
|
||||
@@ -26,7 +26,7 @@ _[
|
||||
NoBuild = true,
|
||||
});
|
||||
|
||||
DotNetTest("./test/Spectre.Console.Cli.Tests/Spectre.Console.Cli.Tests.csproj", new DotNetTestSettings {
|
||||
Configuration = configuration,
|
||||
NoRestore = true,
|
||||
NoBuild = true,
|
||||
});
|
||||
|
||||
DotNetTest("./test/Spectre.Console.Analyzer.Tests/Spectre.Console.Analyzer.Tests.csproj", new DotNetTestSettings {
|
||||
Configuration = configuration,
|
||||
NoRestore = true,
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<PackageReference Include="Statiq.CodeAnalysis" Version="1.0.0-beta.58" />
|
||||
<PackageReference Include="Statiq.Common" Version="1.0.0-beta.58" />
|
||||
<PackageReference Include="Statiq.Web" Version="1.0.0-beta.44" />
|
||||
<PackageReference Include="MinVer" PrivateAssets="All" Version="2.3.1" />
|
||||
<PackageReference Include="MinVer" PrivateAssets="All" Version="2.5.0" />
|
||||
<PackageReference Include="Statiq.Web.Netlify" Version="1.0.0-beta.44" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Docs
|
||||
.AddSetting(Constants.SourceFiles, new List<string>
|
||||
{
|
||||
"../../src/Spectre.Console/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs",
|
||||
"../../src/Spectre.Console.Cli/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs",
|
||||
"../../src/Spectre.Console.ImageSharp/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs"
|
||||
})
|
||||
.AddSetting(Constants.ExampleSourceFiles, new List<string>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "2.2.200",
|
||||
"rollForward": "latestMajor"
|
||||
"version": "6.0.300",
|
||||
"rollForward": "latestFeature"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
Title: Spectre.Console 0.44 released!
|
||||
Description: Alternate screen buffers, better exception rendering... and more!
|
||||
Published: 20220327
|
||||
Category: Release Notes
|
||||
Excluded: false
|
||||
---
|
||||
|
||||
Version 0.44 of Spectre.Console has been released!
|
||||
|
||||
There are a lot of fixes and improvements in this release, but the most noteworthy
|
||||
additions are better exception rendering, support for alternate screen buffers,
|
||||
and a new widget called [TextPath](xref:T:Spectre.Console.TextPath), which makes
|
||||
it easy to render paths in the console.
|
||||
|
||||
Check out the two new examples in our GitHub repository:
|
||||
|
||||
* [./examples/Console/AlternateScreen](https://github.com/spectreconsole/spectre.console/blob/main/examples/Console/AlternateScreen/Program.cs)
|
||||
* [./examples/Console/Paths](https://github.com/spectreconsole/spectre.console/blob/main/examples/Console/Paths/Program.cs)
|
||||
|
||||
## New Contributors
|
||||
|
||||
* [@twaalewijn](https://github.com/twaalewijn) made their first contribution in [#642](https://github.com/spectreconsole/spectre.console/pull/642)
|
||||
* [@zmrfzn](https://github.com/zmrfzn) made their first contribution in [#652](https://github.com/spectreconsole/spectre.console/pull/652)
|
||||
* [@jouniheikniemi](https://github.com/jouniheikniemi) made their first contribution in [#689](https://github.com/spectreconsole/spectre.console/pull/689)
|
||||
* [@Sir-Baconn](https://github.com/Sir-Baconn) made their first contribution in [#682](https://github.com/spectreconsole/spectre.console/pull/682)
|
||||
* [@seclerp](https://github.com/seclerp) made their first contribution in [#665](https://github.com/spectreconsole/spectre.console/pull/665)
|
||||
* [@Arcodiant](https://github.com/Arcodiant) made their first contribution in [#748](https://github.com/spectreconsole/spectre.console/pull/748)
|
||||
* [@ap0llo](https://github.com/ap0llo) made their first contribution in [#681](https://github.com/spectreconsole/spectre.console/pull/681)
|
||||
|
||||
## What's Changed
|
||||
|
||||
* Added the ability to hide CommandOptions. by [@twaalewijn](https://github.com/twaalewijn) in [#642](https://github.com/spectreconsole/spectre.console/pull/642)
|
||||
* Add support for alternate screen buffers by [@patriksvensson](https://github.com/patriksvensson) in [#647](https://github.com/spectreconsole/spectre.console/pull/647)
|
||||
* Updates asciinema update by [@phil-scott-78](https://github.com/phil-scott-78) in [#648](https://github.com/spectreconsole/spectre.console/pull/648)
|
||||
* Update Roslynator.Analyzers to version 3.3 by [@phil-scott-78](https://github.com/phil-scott-78) in [#650](https://github.com/spectreconsole/spectre.console/pull/650)
|
||||
* Ordered CommandArguments by position by [@nils-a](https://github.com/nils-a) in [#646](https://github.com/spectreconsole/spectre.console/pull/646)
|
||||
* Table title's first letter is getting capitalized by default by [@zmrfzn](https://github.com/zmrfzn) in [#652](https://github.com/spectreconsole/spectre.console/pull/652)
|
||||
* Simplify stack frame parsing by [@0xced](https://github.com/0xced) in [#637](https://github.com/spectreconsole/spectre.console/pull/637)
|
||||
* Trying to rework dotnet tools for docs and playwright by [@phil-scott-78](https://github.com/phil-scott-78) in [#667](https://github.com/spectreconsole/spectre.console/pull/667)
|
||||
* Add release notes for 0.43.0 by [@patriksvensson](https://github.com/patriksvensson) in [#663](https://github.com/spectreconsole/spectre.console/pull/663)
|
||||
* Use file scoped namespace declarations by [@patriksvensson](https://github.com/patriksvensson) in [#666](https://github.com/spectreconsole/spectre.console/pull/666)
|
||||
* Add global usings by [@patriksvensson](https://github.com/patriksvensson) in [#668](https://github.com/spectreconsole/spectre.console/pull/668)
|
||||
* Changed TypeResolver in Cli/logging by [@nils-a](https://github.com/nils-a) in [#675](https://github.com/spectreconsole/spectre.console/pull/675)
|
||||
* Invalid WithExample call on the CommandApp doc page by [@jouniheikniemi](https://github.com/jouniheikniemi) in [#689](https://github.com/spectreconsole/spectre.console/pull/689)
|
||||
* Add overload with params array for AddChoiceGroup() by [@Sir-Baconn](https://github.com/Sir-Baconn) in [#682](https://github.com/spectreconsole/spectre.console/pull/682)
|
||||
* Simplify exception formatting by [@0xced](https://github.com/0xced) in [#695](https://github.com/spectreconsole/spectre.console/pull/695)
|
||||
* Improves exception rendering for async methods in .NET 6 by [@phil-scott-78](https://github.com/phil-scott-78) in [#718](https://github.com/spectreconsole/spectre.console/pull/718)
|
||||
* Adding better type names for return types and parameters by [@phil-scott-78](https://github.com/phil-scott-78) in [#719](https://github.com/spectreconsole/spectre.console/pull/719)
|
||||
* Docs redesign by [@phil-scott-78](https://github.com/phil-scott-78) in [#728](https://github.com/spectreconsole/spectre.console/pull/728)
|
||||
* Configures deployment to netlify by [@phil-scott-78](https://github.com/phil-scott-78) in [#729](https://github.com/spectreconsole/spectre.console/pull/729)
|
||||
* Tweaking font-size and line-height for smaller screens by [@phil-scott-78](https://github.com/phil-scott-78) in [#730](https://github.com/spectreconsole/spectre.console/pull/730)
|
||||
* Adding a best practices guide. by [@phil-scott-78](https://github.com/phil-scott-78) in [#744](https://github.com/spectreconsole/spectre.console/pull/744)
|
||||
* Adds widget for displaying (pretty) paths by [@patriksvensson](https://github.com/patriksvensson) in [#734](https://github.com/spectreconsole/spectre.console/pull/734)
|
||||
* Add missing inheritance and nullable types in settings.md by [@seclerp](https://github.com/seclerp) in [#665](https://github.com/spectreconsole/spectre.console/pull/665)
|
||||
* Optimizing build by [@phil-scott-78](https://github.com/phil-scott-78) in [#747](https://github.com/spectreconsole/spectre.console/pull/747)
|
||||
* Update SixLabors.ImageSharp reference by [@Arcodiant](https://github.com/Arcodiant) in [#748](https://github.com/spectreconsole/spectre.console/pull/748)
|
||||
* Add support for styling and aligning paths by [@patriksvensson](https://github.com/patriksvensson) in [#746](https://github.com/spectreconsole/spectre.console/pull/746)
|
||||
* Add documentation for `TextPath` widget by [@patriksvensson](https://github.com/patriksvensson) in [#757](https://github.com/spectreconsole/spectre.console/pull/757)
|
||||
* Fix path and description for TextPath docs by [@patriksvensson](https://github.com/patriksvensson) in [#758](https://github.com/spectreconsole/spectre.console/pull/758)
|
||||
* Adding a short template file for new documentation by [@phil-scott-78](https://github.com/phil-scott-78) in [#763](https://github.com/spectreconsole/spectre.console/pull/763)
|
||||
* Introduce MarkupInterpolated and MarkupLineInterpolated extensions by [@phil-scott-78](https://github.com/phil-scott-78) in [#761](https://github.com/spectreconsole/spectre.console/pull/761)
|
||||
* Obsolete the AnsiConsoleFactory class by [@0xced](https://github.com/0xced) in [#585](https://github.com/spectreconsole/spectre.console/pull/585)
|
||||
* Add option to configure the style of the choices list and the default value in TextPrompt by [@ap0llo](https://github.com/ap0llo) in [#681](https://github.com/spectreconsole/spectre.console/pull/681)
|
||||
@@ -46,7 +46,7 @@ AnsiConsole.Status()
|
||||
});
|
||||
```
|
||||
|
||||
## Asynchronous progress
|
||||
## Asynchronous status
|
||||
|
||||
If you prefer to use async/await, you can use `StartAsync` instead of `Start`.
|
||||
|
||||
|
||||
@@ -66,10 +66,11 @@ AnsiConsole.Markup("[red]{0}[/]", Markup.Escape("Hello [World]"));
|
||||
|
||||
## Escaping Interpolated Strings
|
||||
|
||||
When working with interpolated string, you can use the `MarkupInterpolated` and `MarkupInterpolatedLine` methods to automatically escape the values in the interpolated string holes.
|
||||
When working with interpolated string, you can use the `MarkupInterpolated` and `MarkupLineInterpolated` methods to automatically escape the values in the interpolated string holes.
|
||||
|
||||
```csharp
|
||||
AnsiConsole.MarkupInterpolated("[red]{0}[/]", "Hello [World]");
|
||||
string hello = "Hello [World]";
|
||||
AnsiConsole.MarkupInterpolated($"[red]{hello}[/]");
|
||||
```
|
||||
|
||||
## Setting background color
|
||||
|
||||
@@ -43,7 +43,7 @@ AnsiConsole.Write(root);
|
||||
## Collapsing nodes
|
||||
|
||||
```csharp
|
||||
root.AddNode("Label").Collapsed();
|
||||
root.AddNode("Label").Collapse();
|
||||
```
|
||||
|
||||
## Appearance
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"cake.tool": {
|
||||
"version": "2.0.0-rc0001",
|
||||
"version": "2.2.0",
|
||||
"commands": [
|
||||
"dotnet-cake"
|
||||
]
|
||||
},
|
||||
"gpr": {
|
||||
"version": "0.1.224",
|
||||
"version": "0.1.281",
|
||||
"commands": [
|
||||
"gpr"
|
||||
]
|
||||
},
|
||||
"dotnet-example": {
|
||||
"version": "1.5.0",
|
||||
"version": "1.6.0",
|
||||
"commands": [
|
||||
"dotnet-example"
|
||||
]
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Spectre.Console\Spectre.Console.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Spectre.Console.Cli\Spectre.Console.Cli.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.8" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
|
||||
<PackageReference Include="Serilog" Version="2.10.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog" Version="2.11.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Map" Version="1.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -75,6 +75,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Spectre.Console.ImageSharp"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Paths", "Console\Paths\Paths.csproj", "{65CB00B0-A3AE-4E8F-A990-4C8C1A232FE2}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Spectre.Console.Cli", "..\src\Spectre.Console.Cli\Spectre.Console.Cli.csproj", "{EFAADF6A-C77D-41EC-83F5-BBB4FFC5A6D7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -493,6 +495,18 @@ Global
|
||||
{65CB00B0-A3AE-4E8F-A990-4C8C1A232FE2}.Release|x64.Build.0 = Release|Any CPU
|
||||
{65CB00B0-A3AE-4E8F-A990-4C8C1A232FE2}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{65CB00B0-A3AE-4E8F-A990-4C8C1A232FE2}.Release|x86.Build.0 = Release|Any CPU
|
||||
{EFAADF6A-C77D-41EC-83F5-BBB4FFC5A6D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EFAADF6A-C77D-41EC-83F5-BBB4FFC5A6D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EFAADF6A-C77D-41EC-83F5-BBB4FFC5A6D7}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{EFAADF6A-C77D-41EC-83F5-BBB4FFC5A6D7}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{EFAADF6A-C77D-41EC-83F5-BBB4FFC5A6D7}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{EFAADF6A-C77D-41EC-83F5-BBB4FFC5A6D7}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{EFAADF6A-C77D-41EC-83F5-BBB4FFC5A6D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EFAADF6A-C77D-41EC-83F5-BBB4FFC5A6D7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EFAADF6A-C77D-41EC-83F5-BBB4FFC5A6D7}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{EFAADF6A-C77D-41EC-83F5-BBB4FFC5A6D7}.Release|x64.Build.0 = Release|Any CPU
|
||||
{EFAADF6A-C77D-41EC-83F5-BBB4FFC5A6D7}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{EFAADF6A-C77D-41EC-83F5-BBB4FFC5A6D7}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -506,6 +520,7 @@ Global
|
||||
{DD8EC1B0-F50C-44E4-8399-2D560F95E572} = {2571F1BD-6556-4F96-B27B-B6190E1BF13A}
|
||||
{0C58FB17-F60A-47AB-84BF-961EC8C06AE6} = {2571F1BD-6556-4F96-B27B-B6190E1BF13A}
|
||||
{A127CE7D-A5A7-4745-9809-EBD7CB12CEE7} = {2571F1BD-6556-4F96-B27B-B6190E1BF13A}
|
||||
{EFAADF6A-C77D-41EC-83F5-BBB4FFC5A6D7} = {2571F1BD-6556-4F96-B27B-B6190E1BF13A}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {3EE724C5-CAB4-410D-AC63-8D4260EF83ED}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Spectre.Console.Cli\Spectre.Console.Cli.csproj" />
|
||||
<ProjectReference Include="..\..\src\Spectre.Console\Spectre.Console.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"projects": [ "src", "tests" ],
|
||||
"sdk": {
|
||||
"version": "6.0.100",
|
||||
"version": "6.0.300",
|
||||
"rollForward": "latestFeature"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,12 +32,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="MinVer" PrivateAssets="All" Version="2.4.0" />
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" Version="1.0.0" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.312">
|
||||
<PackageReference Include="MinVer" PrivateAssets="All" Version="4.1.0" />
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" Version="1.1.1" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435">
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Roslynator.Analyzers" Version="3.3.0">
|
||||
<PackageReference Include="Roslynator.Analyzers" Version="4.1.1">
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Include="..\stylecop.json" Link="Properties/stylecop.json" />
|
||||
|
||||
6
src/Spectre.Console.Analyzer.v3.ncrunchsolution
Normal file
6
src/Spectre.Console.Analyzer.v3.ncrunchsolution
Normal file
@@ -0,0 +1,6 @@
|
||||
<SolutionConfiguration>
|
||||
<Settings>
|
||||
<AllowParallelTestExecution>True</AllowParallelTestExecution>
|
||||
<SolutionConfigured>True</SolutionConfigured>
|
||||
</Settings>
|
||||
</SolutionConfiguration>
|
||||
@@ -24,7 +24,7 @@ public class FavorInstanceAnsiConsoleOverStaticAnalyzer : SpectreAnalyzer
|
||||
// if this operation isn't an invocation against one of the System.Console methods
|
||||
// defined in _methods then we can safely stop analyzing and return;
|
||||
var invocationOperation = (IInvocationOperation)context.Operation;
|
||||
if (!Equals(invocationOperation.TargetMethod.ContainingType, ansiConsoleType))
|
||||
if (!SymbolEqualityComparer.Default.Equals(invocationOperation.TargetMethod.ContainingType, ansiConsoleType))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class FavorInstanceAnsiConsoleOverStaticAnalyzer : SpectreAnalyzer
|
||||
.Ancestors().OfType<MethodDeclarationSyntax>()
|
||||
.First()
|
||||
.ParameterList.Parameters
|
||||
.Any(i => i.Type.NormalizeWhitespace().ToString() == "IAnsiConsole");
|
||||
.Any(i => i.Type?.NormalizeWhitespace()?.ToString() == "IAnsiConsole");
|
||||
}
|
||||
|
||||
private static bool HasFieldAnsiConsole(SyntaxNode syntaxNode)
|
||||
@@ -72,7 +72,7 @@ public class FavorInstanceAnsiConsoleOverStaticAnalyzer : SpectreAnalyzer
|
||||
.Ancestors()
|
||||
.OfType<MethodDeclarationSyntax>()
|
||||
.First()
|
||||
.Modifiers.Any(i => i.Kind() == SyntaxKind.StaticKeyword);
|
||||
.Modifiers.Any(i => i.IsKind(SyntaxKind.StaticKeyword));
|
||||
|
||||
return syntaxNode
|
||||
.Ancestors().OfType<ClassDeclarationSyntax>()
|
||||
@@ -81,6 +81,6 @@ public class FavorInstanceAnsiConsoleOverStaticAnalyzer : SpectreAnalyzer
|
||||
.OfType<FieldDeclarationSyntax>()
|
||||
.Any(i =>
|
||||
i.Declaration.Type.NormalizeWhitespace().ToString() == "IAnsiConsole" &&
|
||||
(!isStatic ^ i.Modifiers.Any(modifier => modifier.Kind() == SyntaxKind.StaticKeyword)));
|
||||
(!isStatic ^ i.Modifiers.Any(modifier => modifier.IsKind(SyntaxKind.StaticKeyword))));
|
||||
}
|
||||
}
|
||||
@@ -33,12 +33,14 @@ public class NoConcurrentLiveRenderablesAnalyzer : SpectreAnalyzer
|
||||
.Select(i => context.Compilation.GetTypeByMetadataName(i))
|
||||
.ToImmutableArray();
|
||||
|
||||
if (liveTypes.All(i => !Equals(i, methodSymbol.ContainingType)))
|
||||
if (liveTypes.All(i => !SymbolEqualityComparer.Default.Equals(i, methodSymbol.ContainingType)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#pragma warning disable RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer
|
||||
var model = context.Compilation.GetSemanticModel(context.Operation.Syntax.SyntaxTree);
|
||||
#pragma warning restore RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer
|
||||
var parentInvocations = invocationOperation
|
||||
.Syntax.Ancestors()
|
||||
.OfType<InvocationExpressionSyntax>()
|
||||
|
||||
@@ -34,12 +34,15 @@ public class NoPromptsDuringLiveRenderablesAnalyzer : SpectreAnalyzer
|
||||
var ansiConsoleType = context.Compilation.GetTypeByMetadataName("Spectre.Console.AnsiConsole");
|
||||
var ansiConsoleExtensionsType = context.Compilation.GetTypeByMetadataName("Spectre.Console.AnsiConsoleExtensions");
|
||||
|
||||
if (!Equals(methodSymbol.ContainingType, ansiConsoleType) && !Equals(methodSymbol.ContainingType, ansiConsoleExtensionsType))
|
||||
if (!SymbolEqualityComparer.Default.Equals(methodSymbol.ContainingType, ansiConsoleType) &&
|
||||
!SymbolEqualityComparer.Default.Equals(methodSymbol.ContainingType, ansiConsoleExtensionsType))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#pragma warning disable RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer
|
||||
var model = context.Compilation.GetSemanticModel(context.Operation.Syntax.SyntaxTree);
|
||||
#pragma warning restore RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer
|
||||
var parentInvocations = invocationOperation
|
||||
.Syntax.Ancestors()
|
||||
.OfType<InvocationExpressionSyntax>()
|
||||
|
||||
@@ -33,7 +33,7 @@ public class UseSpectreInsteadOfSystemConsoleAnalyzer : SpectreAnalyzer
|
||||
|
||||
var systemConsoleType = context.Compilation.GetTypeByMetadataName("System.Console");
|
||||
|
||||
if (!Equals(invocationOperation.TargetMethod.ContainingType, systemConsoleType))
|
||||
if (!SymbolEqualityComparer.Default.Equals(invocationOperation.TargetMethod.ContainingType, systemConsoleType))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,11 @@ public class SwitchToAnsiConsoleAction : CodeAction
|
||||
var originalCaller = ((MemberAccessExpressionSyntax)_originalInvocation.Expression).Name.ToString();
|
||||
|
||||
var syntaxTree = await _document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
|
||||
if (syntaxTree == null)
|
||||
{
|
||||
return _document;
|
||||
}
|
||||
|
||||
var root = (CompilationUnitSyntax)await syntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// If there is an ansiConsole passed into the method then we'll use it.
|
||||
@@ -66,7 +71,7 @@ public class SwitchToAnsiConsoleAction : CodeAction
|
||||
.Ancestors().OfType<MethodDeclarationSyntax>()
|
||||
.First()
|
||||
.ParameterList.Parameters
|
||||
.FirstOrDefault(i => i.Type.NormalizeWhitespace().ToString() == "IAnsiConsole")
|
||||
.FirstOrDefault(i => i.Type?.NormalizeWhitespace()?.ToString() == "IAnsiConsole")
|
||||
?.Identifier.Text;
|
||||
}
|
||||
|
||||
@@ -79,7 +84,7 @@ public class SwitchToAnsiConsoleAction : CodeAction
|
||||
.Ancestors()
|
||||
.OfType<MethodDeclarationSyntax>()
|
||||
.First()
|
||||
.Modifiers.Any(i => i.Kind() == SyntaxKind.StaticKeyword);
|
||||
.Modifiers.Any(i => i.IsKind(SyntaxKind.StaticKeyword));
|
||||
|
||||
return _originalInvocation
|
||||
.Ancestors().OfType<ClassDeclarationSyntax>()
|
||||
@@ -88,7 +93,7 @@ public class SwitchToAnsiConsoleAction : CodeAction
|
||||
.OfType<FieldDeclarationSyntax>()
|
||||
.FirstOrDefault(i =>
|
||||
i.Declaration.Type.NormalizeWhitespace().ToString() == "IAnsiConsole" &&
|
||||
(!isStatic ^ i.Modifiers.Any(modifier => modifier.Kind() == SyntaxKind.StaticKeyword)))
|
||||
(!isStatic ^ i.Modifiers.Any(modifier => modifier.IsKind(SyntaxKind.StaticKeyword))))
|
||||
?.Declaration.Variables.First().Identifier.Text;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,18 @@ public class StaticAnsiConsoleToInstanceFix : CodeFixProvider
|
||||
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
|
||||
{
|
||||
var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
|
||||
var methodDeclaration = root.FindNode(context.Span).FirstAncestorOrSelf<InvocationExpressionSyntax>();
|
||||
context.RegisterCodeFix(
|
||||
new SwitchToAnsiConsoleAction(context.Document, methodDeclaration, "Convert static AnsiConsole calls to local instance."),
|
||||
context.Diagnostics);
|
||||
if (root != null)
|
||||
{
|
||||
var methodDeclaration = root.FindNode(context.Span).FirstAncestorOrSelf<InvocationExpressionSyntax>();
|
||||
if (methodDeclaration != null)
|
||||
{
|
||||
context.RegisterCodeFix(
|
||||
new SwitchToAnsiConsoleAction(
|
||||
context.Document,
|
||||
methodDeclaration,
|
||||
"Convert static AnsiConsole calls to local instance."),
|
||||
context.Diagnostics);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,9 +18,18 @@ public class SystemConsoleToAnsiConsoleFix : CodeFixProvider
|
||||
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
|
||||
{
|
||||
var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
|
||||
var methodDeclaration = root.FindNode(context.Span).FirstAncestorOrSelf<InvocationExpressionSyntax>();
|
||||
context.RegisterCodeFix(
|
||||
new SwitchToAnsiConsoleAction(context.Document, methodDeclaration, "Convert static call to AnsiConsole to Spectre.Console.AnsiConsole"),
|
||||
context.Diagnostics);
|
||||
if (root != null)
|
||||
{
|
||||
var methodDeclaration = root.FindNode(context.Span).FirstAncestorOrSelf<InvocationExpressionSyntax>();
|
||||
if (methodDeclaration != null)
|
||||
{
|
||||
context.RegisterCodeFix(
|
||||
new SwitchToAnsiConsoleAction(
|
||||
context.Document,
|
||||
methodDeclaration,
|
||||
"Convert static call to AnsiConsole to Spectre.Console.AnsiConsole"),
|
||||
context.Diagnostics);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>Best practice analyzers for Spectre.Console.</Description>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<IsPackable>true</IsPackable>
|
||||
<DevelopmentDependency>true</DevelopmentDependency>
|
||||
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||
<Nullable>enable</Nullable>
|
||||
<NoPackageAnalysis>true</NoPackageAnalysis>
|
||||
@@ -15,9 +16,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="2.9.8" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.6.1" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.6.1" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.2.0" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.2.0" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.2.0" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -45,6 +45,13 @@ internal static class CommandConstructorBinder
|
||||
}
|
||||
}
|
||||
|
||||
// Validate the settings.
|
||||
var validationResult = settings.Validate();
|
||||
if (!validationResult.Successful)
|
||||
{
|
||||
throw CommandRuntimeException.ValidationFailed(validationResult);
|
||||
}
|
||||
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user