-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from nd1012/dev
+ Added `CliApiContext.ForceDisplayHelp` + Default CLI API helper won't diplay help on API method execution error (only display the exception) + `CliHelpApi` won't display help on API method execution error + Added `AboutApi` - Fixed wrong error display, when the exit code was not zero
- Loading branch information
Showing
28 changed files
with
1,023 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using Spectre.Console; | ||
using System.ComponentModel; | ||
using System.Reflection; | ||
using wan24.Core; | ||
|
||
namespace wan24.CLI | ||
{ | ||
/// <summary> | ||
/// About CLI API | ||
/// </summary> | ||
[CliApi("about")] | ||
[DisplayText("About")] | ||
[Description("Display informations about this CLI app")] | ||
public sealed class AboutApi | ||
{ | ||
/// <summary> | ||
/// Constructor | ||
/// </summary> | ||
public AboutApi() { } | ||
|
||
/// <summary> | ||
/// App title | ||
/// </summary> | ||
public static string Title { get; set; } = Settings.AppId; | ||
|
||
/// <summary> | ||
/// App informations to display (Spectre.Console markup is supported) | ||
/// </summary> | ||
public static string? Info { get; set; } | ||
|
||
/// <summary> | ||
/// App version | ||
/// </summary> | ||
public static Version Version { get; set; } = new("1.0.0"); | ||
|
||
/// <summary> | ||
/// Display the app informations | ||
/// </summary> | ||
[CliApi("info", IsDefault = true)] | ||
[DisplayText("Informations")] | ||
[Description("Display detailed app informations")] | ||
public static void DisplayInfo() | ||
{ | ||
DisplayVersion(); | ||
if (Info is null) return; | ||
Console.WriteLine(); | ||
AnsiConsole.WriteLine(Info); | ||
} | ||
|
||
/// <summary> | ||
/// Display the app version | ||
/// </summary> | ||
[CliApi("version")] | ||
[DisplayText("Version")] | ||
[Description("Display app version informations")] | ||
public static void DisplayVersion() => Console.WriteLine($"{Title} version {Version} ({(ENV.IsDebug ? "Debug build" : "Release build")})"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Text; | ||
|
||
namespace wan24.CLI | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Andreas Zimmermann, wan24.de | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
64 changes: 64 additions & 0 deletions
64
src/wan24-CLI/wan24-CLI licenses/Microsoft.Extensions.Configuration.Abstractions.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
|
||
<!DOCTYPE html> | ||
|
||
<html lang="en"> | ||
<head> | ||
<link rel="stylesheet" href="/Content/Site.css" /> | ||
<title>'MIT' reference</title> | ||
</head> | ||
<body> | ||
<div id="main-content"> | ||
|
||
|
||
|
||
<h1>MIT License</h1> | ||
|
||
<h2>SPDX identifier</h2> | ||
<div id="license-expression">MIT</div> | ||
|
||
<h2>License text</h2> | ||
|
||
<div class="optional-license-text"> | ||
<p>MIT License</p> | ||
|
||
</div> | ||
<div class="replaceable-license-text"> | ||
<p>Copyright (c) <year> <copyright holders> | ||
</p> | ||
|
||
</div> | ||
|
||
<p>Permission is hereby granted, free of charge, to any person obtaining a copy of <var class="replaceable-license-text"> this software and | ||
associated documentation files</var> (the "Software"), to deal in the Software without restriction, | ||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions:</p> | ||
|
||
<p>The above copyright notice and this permission notice | ||
<var class="optional-license-text"> (including the next paragraph)</var> | ||
shall be included in all copies or substantial | ||
portions of the Software.</p> | ||
|
||
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT | ||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
NO EVENT SHALL <var class="replaceable-license-text"> THE AUTHORS OR COPYRIGHT HOLDERS</var> BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<h2>SPDX web page</h2> | ||
<ul> | ||
<li><a href="https://spdx.org/licenses/MIT.html">https://spdx.org/licenses/MIT.html</a></li> | ||
</ul> | ||
|
||
<h2>Notice</h2> | ||
<p>This license content is provided by the <a href="https://spdx.dev/">SPDX project</a>. For more information about <b>licenses.nuget.org</b>, see <a href="https://aka.ms/licenses.nuget.org">our documentation</a>. | ||
|
||
<p><i>Data pulled from <a href="https://github.com/spdx/license-list-data">spdx/license-list-data</a> on February 9, 2023.</i></p> | ||
</div> | ||
</body> | ||
</html> |
64 changes: 64 additions & 0 deletions
64
src/wan24-CLI/wan24-CLI licenses/Microsoft.Extensions.DependencyInjection.Abstractions.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
|
||
<!DOCTYPE html> | ||
|
||
<html lang="en"> | ||
<head> | ||
<link rel="stylesheet" href="/Content/Site.css" /> | ||
<title>'MIT' reference</title> | ||
</head> | ||
<body> | ||
<div id="main-content"> | ||
|
||
|
||
|
||
<h1>MIT License</h1> | ||
|
||
<h2>SPDX identifier</h2> | ||
<div id="license-expression">MIT</div> | ||
|
||
<h2>License text</h2> | ||
|
||
<div class="optional-license-text"> | ||
<p>MIT License</p> | ||
|
||
</div> | ||
<div class="replaceable-license-text"> | ||
<p>Copyright (c) <year> <copyright holders> | ||
</p> | ||
|
||
</div> | ||
|
||
<p>Permission is hereby granted, free of charge, to any person obtaining a copy of <var class="replaceable-license-text"> this software and | ||
associated documentation files</var> (the "Software"), to deal in the Software without restriction, | ||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions:</p> | ||
|
||
<p>The above copyright notice and this permission notice | ||
<var class="optional-license-text"> (including the next paragraph)</var> | ||
shall be included in all copies or substantial | ||
portions of the Software.</p> | ||
|
||
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT | ||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
NO EVENT SHALL <var class="replaceable-license-text"> THE AUTHORS OR COPYRIGHT HOLDERS</var> BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<h2>SPDX web page</h2> | ||
<ul> | ||
<li><a href="https://spdx.org/licenses/MIT.html">https://spdx.org/licenses/MIT.html</a></li> | ||
</ul> | ||
|
||
<h2>Notice</h2> | ||
<p>This license content is provided by the <a href="https://spdx.dev/">SPDX project</a>. For more information about <b>licenses.nuget.org</b>, see <a href="https://aka.ms/licenses.nuget.org">our documentation</a>. | ||
|
||
<p><i>Data pulled from <a href="https://github.com/spdx/license-list-data">spdx/license-list-data</a> on February 9, 2023.</i></p> | ||
</div> | ||
</body> | ||
</html> |
Oops, something went wrong.