mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-10-31 17:15:28 +08:00 
			
		
		
		
	Add examples of how to use Spectre.Console
This commit is contained in:
		
							
								
								
									
										14
									
								
								examples/Grid/Grid.csproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								examples/Grid/Grid.csproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| <Project Sdk="Microsoft.NET.Sdk"> | ||||
|  | ||||
|   <PropertyGroup> | ||||
|     <OutputType>Exe</OutputType> | ||||
|     <TargetFramework>netcoreapp3.1</TargetFramework> | ||||
|     <IsPackable>false</IsPackable> | ||||
|     <Description>Demonstrates how to render grids in a console.</Description> | ||||
|   </PropertyGroup> | ||||
|  | ||||
|   <ItemGroup> | ||||
|     <ProjectReference Include="..\..\src\Spectre.Console\Spectre.Console.csproj" /> | ||||
|   </ItemGroup> | ||||
|  | ||||
| </Project> | ||||
							
								
								
									
										26
									
								
								examples/Grid/Program.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								examples/Grid/Program.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| using System; | ||||
| using Spectre.Console; | ||||
|  | ||||
| namespace GridExample | ||||
| { | ||||
|     public sealed class Program | ||||
|     { | ||||
|         static void Main(string[] args) | ||||
|         { | ||||
|             AnsiConsole.WriteLine(); | ||||
|             AnsiConsole.MarkupLine("Usage: [grey]dotnet [blue]run[/] [[options] [[[[--] <additional arguments>...]][/]"); | ||||
|             AnsiConsole.WriteLine(); | ||||
|  | ||||
|             var grid = new Grid(); | ||||
|             grid.AddColumn(new GridColumn { NoWrap = true }); | ||||
|             grid.AddColumn(new GridColumn { NoWrap = true, Width = 2 }); | ||||
|             grid.AddColumn(); | ||||
|             grid.AddRow("Options:", "", ""); | ||||
|             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]-v[/], [blue]--verbosity[/] <LEVEL>", "", "Set the [grey]MSBuild[/] verbosity level."); | ||||
|  | ||||
|             AnsiConsole.Render(grid); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Patrik Svensson
					Patrik Svensson