Skip to content

Commit

Permalink
fixed line-endings
Browse files Browse the repository at this point in the history
  • Loading branch information
nils-a authored and patriksvensson committed Nov 27, 2023
1 parent 989c0b9 commit 44300c8
Show file tree
Hide file tree
Showing 79 changed files with 2,643 additions and 2,643 deletions.
154 changes: 77 additions & 77 deletions docs/Program.cs
Original file line number Diff line number Diff line change
@@ -1,77 +1,77 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Docs.Extensions;
using Docs.Shortcodes;
using Docs.Utilities;
using Microsoft.Extensions.DependencyInjection;
using Statiq.App;
using Statiq.Common;
using Statiq.Core;
using Statiq.Web;

namespace Docs
{
public static class Program
{
public static async Task<int> Main(string[] args) =>
await Bootstrapper.Factory
.CreateWeb(args)
.AddSetting(Keys.Host, "spectreconsole.net")
.AddSetting(Keys.LinksUseHttps, true)
.AddSetting(Constants.EditLink, ConfigureEditLink())
.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",
"../../src/Spectre.Console.Json/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs"
})
.AddSetting(Constants.ExampleSourceFiles, new List<string>
{
"../../examples/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs",
}
)
.ConfigureServices(i =>
{
i.AddSingleton(new TypeNameLinks());
})
.ConfigureSite("spectreconsole", "spectre.console", "main")
.AddShortcode("Children", typeof(ChildrenShortcode))
.AddShortcode("ColorTable", typeof(ColorTableShortcode))
.AddShortcode("EmojiTable", typeof(EmojiTableShortcode))
.AddShortcode("Alert", typeof(AlertShortcode))
.AddShortcode("Info", typeof(InfoShortcode))
.AddShortcode("AsciiCast", typeof(AsciiCastShortcode))
.AddShortcode("Example", typeof(ExampleSnippet))
.AddPipelines()
.BuildPipeline(
"Bootstrap",
builder => builder
.WithInputReadFiles("../node_modules/asciinema-player/dist/bundle/asciinema-player.js")
.WithProcessModules(new SetDestination(Config.FromDocument(doc => new NormalizedPath($"./assets/{doc.Source.FileName}")), true))
.WithOutputWriteFiles()
)
.AddProcess(ProcessTiming.Initialization, _ => new ProcessLauncher("npm", "install --audit false --fund false --progress false")
{
LogErrors = false
})
.AddProcess(ProcessTiming.Initialization, _ => new ProcessLauncher("dotnet", "playwright install chromium"))
.AddProcess(ProcessTiming.BeforeDeployment, _ => new ProcessLauncher("npm", "run build:tailwind")
{
LogErrors = false
})
.RunAsync();

private static Config<string> ConfigureEditLink()
{
return Config.FromDocument((doc, ctx) =>
{
return string.Format("https://github.com/{0}/{1}/edit/{2}/docs/input/{3}",
ctx.GetString(Constants.Site.Owner),
ctx.GetString(Constants.Site.Repository),
ctx.GetString(Constants.Site.Branch),
doc.Source.GetRelativeInputPath());
});
}
}
}
using System.Collections.Generic;
using System.Threading.Tasks;
using Docs.Extensions;
using Docs.Shortcodes;
using Docs.Utilities;
using Microsoft.Extensions.DependencyInjection;
using Statiq.App;
using Statiq.Common;
using Statiq.Core;
using Statiq.Web;

namespace Docs
{
public static class Program
{
public static async Task<int> Main(string[] args) =>
await Bootstrapper.Factory
.CreateWeb(args)
.AddSetting(Keys.Host, "spectreconsole.net")
.AddSetting(Keys.LinksUseHttps, true)
.AddSetting(Constants.EditLink, ConfigureEditLink())
.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",
"../../src/Spectre.Console.Json/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs"
})
.AddSetting(Constants.ExampleSourceFiles, new List<string>
{
"../../examples/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs",
}
)
.ConfigureServices(i =>
{
i.AddSingleton(new TypeNameLinks());
})
.ConfigureSite("spectreconsole", "spectre.console", "main")
.AddShortcode("Children", typeof(ChildrenShortcode))
.AddShortcode("ColorTable", typeof(ColorTableShortcode))
.AddShortcode("EmojiTable", typeof(EmojiTableShortcode))
.AddShortcode("Alert", typeof(AlertShortcode))
.AddShortcode("Info", typeof(InfoShortcode))
.AddShortcode("AsciiCast", typeof(AsciiCastShortcode))
.AddShortcode("Example", typeof(ExampleSnippet))
.AddPipelines()
.BuildPipeline(
"Bootstrap",
builder => builder
.WithInputReadFiles("../node_modules/asciinema-player/dist/bundle/asciinema-player.js")
.WithProcessModules(new SetDestination(Config.FromDocument(doc => new NormalizedPath($"./assets/{doc.Source.FileName}")), true))
.WithOutputWriteFiles()
)
.AddProcess(ProcessTiming.Initialization, _ => new ProcessLauncher("npm", "install --audit false --fund false --progress false")
{
LogErrors = false
})
.AddProcess(ProcessTiming.Initialization, _ => new ProcessLauncher("dotnet", "playwright install chromium"))
.AddProcess(ProcessTiming.BeforeDeployment, _ => new ProcessLauncher("npm", "run build:tailwind")
{
LogErrors = false
})
.RunAsync();

private static Config<string> ConfigureEditLink()
{
return Config.FromDocument((doc, ctx) =>
{
return string.Format("https://github.com/{0}/{1}/edit/{2}/docs/input/{3}",
ctx.GetString(Constants.Site.Owner),
ctx.GetString(Constants.Site.Repository),
ctx.GetString(Constants.Site.Branch),
doc.Source.GetRelativeInputPath());
});
}
}
}
10 changes: 5 additions & 5 deletions docs/input/appendix/styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Description: "*Spectre.Console* makes it easy to write text with different style
Highlights:
- Bold, Italic, Underline, strikethrough
- Dim, Invert
- Conceal, slowblink, rapidblink
- Conceal, slowblink, rapidblink
- Links
---

Expand Down Expand Up @@ -46,9 +46,9 @@ Note that what styles that can be used is defined by the system or your terminal
<tr>
<td><code>strikethrough</code></td>
<td>Shows text with a horizontal line through the center</td>
</tr>
<tr>
<td><code>link</link></td>
<td>Creates a clickable link within text</td>
</tr>
<tr>
<td><code>link</link></td>
<td>Creates a clickable link within text</td>
</tr>
</table>
94 changes: 47 additions & 47 deletions docs/input/cli/command-help.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
Title: Command Help
Order: 13
Description: "Console applications built with *Spectre.Console.Cli* include automatically generated help command line help."
---

Console applications built with `Spectre.Console.Cli` include automatically generated help which is displayed when `-h` or `--help` has been specified on the command line.

The automatically generated help is derived from the configured commands and their command settings.

The help is also context aware and tailored depending on what has been specified on the command line before it. For example,

1. When `-h` or `--help` appears immediately after the application name (eg. `application.exe --help`), then the help displayed is a high-level summary of the application, including any command line examples and a listing of all possible commands the user can execute.

2. When `-h` or `--help` appears immediately after a command has been specified (eg. `application.exe command --help`), then the help displayed is specific to the command and includes information about command specific switches and any default values.

`HelpProvider` is the `Spectre.Console` class responsible for determining context and preparing the help text to write to the console. It is an implementation of the public interface `IHelpProvider`.

## Custom help providers

Whilst it shouldn't be common place to implement your own help provider, it is however possible.

You are able to implement your own `IHelpProvider` and configure a `CommandApp` to use that instead of the Spectre.Console help provider.

```csharp
using Spectre.Console.Cli;

namespace Help;

public static class Program
{
public static int Main(string[] args)
{
var app = new CommandApp<DefaultCommand>();

app.Configure(config =>
{
// Register the custom help provider
config.SetHelpProvider(new CustomHelpProvider(config.Settings));
});

return app.Run(args);
}
}
```

There is a working [example of a custom help provider](https://github.com/spectreconsole/spectre.console/tree/main/examples/Cli/Help) demonstrating this.

Title: Command Help
Order: 13
Description: "Console applications built with *Spectre.Console.Cli* include automatically generated help command line help."
---

Console applications built with `Spectre.Console.Cli` include automatically generated help which is displayed when `-h` or `--help` has been specified on the command line.

The automatically generated help is derived from the configured commands and their command settings.

The help is also context aware and tailored depending on what has been specified on the command line before it. For example,

1. When `-h` or `--help` appears immediately after the application name (eg. `application.exe --help`), then the help displayed is a high-level summary of the application, including any command line examples and a listing of all possible commands the user can execute.

2. When `-h` or `--help` appears immediately after a command has been specified (eg. `application.exe command --help`), then the help displayed is specific to the command and includes information about command specific switches and any default values.

`HelpProvider` is the `Spectre.Console` class responsible for determining context and preparing the help text to write to the console. It is an implementation of the public interface `IHelpProvider`.

## Custom help providers

Whilst it shouldn't be common place to implement your own help provider, it is however possible.

You are able to implement your own `IHelpProvider` and configure a `CommandApp` to use that instead of the Spectre.Console help provider.

```csharp
using Spectre.Console.Cli;

namespace Help;

public static class Program
{
public static int Main(string[] args)
{
var app = new CommandApp<DefaultCommand>();

app.Configure(config =>
{
// Register the custom help provider
config.SetHelpProvider(new CustomHelpProvider(config.Settings));
});

return app.Run(args);
}
}
```

There is a working [example of a custom help provider](https://github.com/spectreconsole/spectre.console/tree/main/examples/Cli/Help) demonstrating this.

Loading

0 comments on commit 44300c8

Please sign in to comment.