@@ -19,26 +19,11 @@ public sealed class CliMode : IDisposable, IMode
1919{
2020 #region
2121
22- private const double COMPLETE = 100.0D ;
23-
24- private static readonly ProgressColumn [ ] PrgCol_1 =
22+ static CliMode ( )
2523 {
26- new TaskDescriptionColumn ( )
27- {
28- Alignment = Justify . Left
29- } ,
30- new SpinnerColumn ( ) ,
31- new ElapsedTimeColumn ( ) ,
32- new ProgressBarColumn ( )
33- } ;
24+ Debug . WriteLine ( $ "{ AConsole . Profile . Capabilities . Unicode } { AConsole . Profile . Capabilities . Links } ") ;
3425
35- private static readonly Progress Prg_1 = AnsiConsole . Progress ( )
36- . AutoClear ( true )
37- . AutoRefresh ( true )
38- . HideCompleted ( true )
39- . Columns ( PrgCol_1 ) ;
40-
41- static CliMode ( ) { }
26+ }
4227
4328 #endregion
4429
@@ -54,6 +39,7 @@ static CliMode() { }
5439
5540 private readonly CancellationTokenSource m_cts ;
5641
42+ public SearchConfig Config => m_cfg ;
5743 public CliMode ( )
5844 {
5945 m_cfg = new SearchConfig ( ) ;
@@ -66,31 +52,33 @@ public CliMode()
6652 {
6753
6854 // await Prg_1.StartAsync(ctx => ValidateInputAsync(ctx, c as string));
69- await ValidateInputAsync ( null , c as string ) ;
70- AnsiConsole . WriteLine ( $ "{ m_query } ") ;
55+ await ValidateInputAsync ( ( c as string ) ! ) ;
56+ AConsole . WriteLine ( $ "{ m_query } ") ;
7157
7258 // var url = await Prg_1.StartAsync(UploadInputAsync);
7359
74- var url = await UploadInputAsync ( null ) ;
75- AnsiConsole . MarkupLine ( $ "[green]{ m_query . Upload } [/]") ;
60+ var url = await UploadInputAsync ( ) ;
7661
77- AnsiConsole . WriteLine ( $ "{ m_cfg } ") ;
62+ AConsole . MarkupLine ( $ "[green] { m_query . Upload } [/] ") ;
7863
79- Console . CancelKeyPress += ( sender , args ) =>
64+ AConsole . WriteLine ( $ "{ m_cfg } ") ;
65+
66+ SConsole . CancelKeyPress += ( sender , args ) =>
8067 {
8168 args . Cancel = false ;
8269 m_cts . Cancel ( ) ;
83- AnsiConsole . MarkupLine ( $ "[red]Cancellation requested { args } [/]") ;
70+ AConsole . MarkupLine ( $ "[red]Cancellation requested { args } [/]") ;
8471 } ;
8572
8673 // await Prg_1.StartAsync(RunSearchAsync);
8774
88- await RunSearchAsync ( null ) ;
75+ await RunSearchAsync ( ) ;
76+
8977 return null ;
9078
9179 }
9280
93- private async Task ValidateInputAsync ( ProgressContext ctx , string c )
81+ private async Task ValidateInputAsync ( string c )
9482 {
9583 // var t = ctx.AddTask("Validating input");
9684 // t.IsIndeterminate = true;
@@ -100,7 +88,7 @@ private async Task ValidateInputAsync(ProgressContext ctx, string c)
10088 // t.Increment(COMPLETE);
10189 }
10290
103- private async Task < Url > UploadInputAsync ( ProgressContext p )
91+ private async Task < Url > UploadInputAsync ( )
10492 {
10593 // var pt = p.AddTask($"Upload");
10694 // pt.IsIndeterminate = true;
@@ -110,7 +98,7 @@ private async Task<Url> UploadInputAsync(ProgressContext p)
11098
11199 }
112100
113- private async Task RunSearchAsync ( ProgressContext ctx )
101+ private async Task RunSearchAsync ( )
114102 {
115103 /*var ptMap = new Dictionary<BaseSearchEngine, (ProgressTask, Table)>();
116104
@@ -170,19 +158,21 @@ void OnResult(object sender, SearchResult sr)
170158 while (!pt1.IsFinished) { }*/
171159 var sw = Stopwatch . StartNew ( ) ;
172160
173- var sp = AnsiConsole . Status ( ) . Spinner ( Spinner . Known . Aesthetic ) . StartAsync ( "Wait..." , async ctx =>
174- {
175- // await ttt;
161+ var sp = AConsole . Status ( )
162+ . Spinner ( Spinner . Known . Aesthetic )
163+ . StartAsync ( "Wait..." , async ctx =>
164+ {
165+ // await ttt;
176166
177- while ( ! ttt . IsCompleted ) {
178- ctx . Refresh ( ) ;
179- await Task . Delay ( TimeSpan . FromMilliseconds ( 300 ) ) ;
167+ while ( ! ttt . IsCompleted ) {
168+ ctx . Refresh ( ) ;
169+ await Task . Delay ( TimeSpan . FromMilliseconds ( 300 ) ) ;
180170
181- ctx . Status =
182- $ "{ m_results . Count } | { m_results . Sum ( c => c . Results . Count ) } | { sw . Elapsed . TotalSeconds : 3F} ";
183- }
184- // m_results2 = await ttt;
185- } ) ;
171+ ctx . Status =
172+ $ "{ m_results . Count } | { m_results . Sum ( c => c . Results . Count ) } | { sw . Elapsed . TotalSeconds : 3F} ";
173+ }
174+ // m_results2 = await ttt;
175+ } ) ;
186176
187177 await ttt ;
188178
@@ -204,7 +194,7 @@ void OnResult(object sender, SearchResult sr)
204194
205195 foreach ( var vt in ptMap . Values ) {
206196 // vt.Item1.StopTask();
207- AnsiConsole . Write ( vt . Item2 ) ;
197+ AConsole . Write ( vt . Item2 ) ;
208198 }
209199
210200 }
0 commit comments