22
33internal static class DefaultRendering
44{
5- public static void Progress ( Action < ProgressContext > ctx )
6- {
5+ public static void Progress ( Action < ProgressContext > ctx ) =>
76 AnsiConsole . Progress ( )
8- . AutoClear ( true )
9- . Columns (
10- new SpinnerColumn ( )
11- {
12- Spinner = Spectre . Console . Spinner . Known . Dots ,
13- Style = Style . Parse ( "bold blue" )
14- } ,
15- new TaskDescriptionColumn ( ) ,
16- new ProgressBarColumn ( )
17- {
18- CompletedStyle = new Style ( Color . Green ) ,
19- FinishedStyle = new Style ( Color . Lime ) ,
20- RemainingStyle = new Style ( Color . Grey )
21- } ,
22- new ElapsedTimeColumn ( ) )
23- . Start ( ctx ) ;
24- }
25-
7+ . AutoClear ( true )
8+ . Columns (
9+ new SpinnerColumn ( )
10+ {
11+ Spinner = Spectre . Console . Spinner . Known . Dots ,
12+ Style = Style . Parse ( "bold blue" )
13+ } ,
14+ new TaskDescriptionColumn ( ) ,
15+ new ProgressBarColumn ( )
16+ {
17+ CompletedStyle = new Style ( Color . Green ) ,
18+ FinishedStyle = new Style ( Color . Lime ) ,
19+ RemainingStyle = new Style ( Color . Grey )
20+ } ,
21+ new ElapsedTimeColumn ( ) )
22+ . Start ( ctx ) ;
23+
2624 public static async Task Spinner ( string status , Func < StatusContext , Task > action )
2725 {
2826 await AnsiConsole . Status ( )
@@ -31,12 +29,10 @@ await AnsiConsole.Status()
3129 . StartAsync ( status , action ) ;
3230 }
3331
34- public static void Rule ( string title )
35- {
32+ public static void Rule ( string title ) =>
3633 AnsiConsole . Write ( new Rule ( title )
3734 . RuleStyle ( new Style ( Color . Grey ) ) ) ;
38- }
39-
35+
4036 public static TResult Prompt < TResult > ( string title , IEnumerable < TResult > options )
4137 {
4238 return AnsiConsole . Prompt ( new SelectionPrompt < TResult > ( )
@@ -57,4 +53,10 @@ public static Table Table(params string[] columns)
5753
5854 return resultTable ;
5955 }
56+
57+ public static void WriteError ( string message ) =>
58+ AnsiConsole . MarkupLine ( $ "[red]Error: { Markup . Escape ( message ) } [/]") ;
59+
60+ public static void WriteSuccess ( string message ) =>
61+ AnsiConsole . MarkupLine ( $ "[green]{ Markup . Escape ( message ) } [/]") ;
6062}
0 commit comments