Skip to content

Commit d30e9ce

Browse files
committed
*
1 parent c8c04d9 commit d30e9ce

File tree

3 files changed

+41
-8
lines changed

3 files changed

+41
-8
lines changed

SmartImage.Rdx/Cli/SearchCommand.cs

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
using Spectre.Console.Rendering;
2020
using System.Collections.Concurrent;
2121
using System.Diagnostics;
22+
using Novus.Streams;
23+
using SixLabors.ImageSharp.Processing;
2224

2325
namespace SmartImage.Rdx.Cli;
2426

@@ -94,6 +96,9 @@ public async Task Interactive()
9496
var choices = new SelectionPrompt<string>()
9597
.Title("Engine")
9698
.AddChoices(select.Keys);
99+
100+
choices.AddChoice("Quit");
101+
choices.AddChoice("...");
97102

98103
string prompt = null;
99104
// AC.Write(m_resTable);
@@ -107,6 +112,26 @@ public async Task Interactive()
107112
AC.Write(v.Table);
108113

109114
}
115+
else {
116+
var stream = Query.Uni.Stream;
117+
stream.TrySeek(0);
118+
// Create the layout
119+
var layout = new Layout("Root")
120+
.SplitColumns(
121+
new Layout("Left"),
122+
new Layout("Right")
123+
.SplitRows(
124+
new Layout("Top"),
125+
new Layout("Bottom")));
126+
127+
// Update the left column
128+
layout["Left"].Update(
129+
new Panel(new CanvasImage(stream))
130+
.Expand());
131+
AC.Clear();
132+
AC.Write(layout);
133+
134+
}
110135
}
111136

112137
/*var fn = rows.GetType()
@@ -140,6 +165,7 @@ public override async Task<int> ExecuteAsync(CommandContext context, SearchComma
140165
var p = ctx.AddTask("Creating query");
141166
p.IsIndeterminate = true;
142167
Query = await SearchQuery.TryCreateAsync(settings.Query);
168+
143169
p.Increment(50);
144170
ctx.Refresh();
145171

@@ -214,12 +240,13 @@ void OnResultComplete(object sender, SearchResult sr)
214240
{
215241
var rm = new ResultModel(sr) { };
216242
m_results.Add(rm);
217-
var i=(int) sr.Engine.EngineOption;
243+
var i = (int) sr.Engine.EngineOption;
218244

219245
grid.AddRow([
220246
new Text(sr.Engine.Name,
221-
new Style(Color.FromInt32(Math.Clamp(i%(int)byte.MaxValue,byte.MinValue,byte.MaxValue)),
222-
decoration: Decoration.Italic)),
247+
new Style(
248+
Color.FromInt32(Math.Clamp(i % (int) byte.MaxValue, byte.MinValue, byte.MaxValue)),
249+
decoration: Decoration.Italic)),
223250

224251
new Text($"{sr.Results.Count}",
225252
new Style(Color.Wheat1,

SmartImage.Rdx/Program.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Kantan.Text;
1+
using System.Diagnostics;
2+
using Kantan.Text;
23
using Microsoft.Extensions.DependencyInjection;
34
using SmartImage.Rdx.Cli;
45
using Spectre.Console;
@@ -21,7 +22,8 @@ public static class Program
2122

2223
public static async Task<int> Main(string[] args)
2324
{
24-
25+
Debug.WriteLine(AC.Profile.Height);
26+
Debug.WriteLine(Console.BufferHeight);
2527
var ff = CliFormat.LoadFigletFontFromResource(nameof(R2.Fg_larry3d), out var ms);
2628

2729
// ms?.Dispose();

SmartImage.Rdx/SmartImage.Rdx.csproj

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@
2525
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
2626
<PackageReference Include="Microsoft.NETCore.Platforms" Version="8.0.0-preview.7.23375.6" />
2727
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.1" />
28-
<PackageReference Include="Spectre.Console" Version="0.48.1-preview.0.1" />
29-
<PackageReference Include="Spectre.Console.Analyzer" Version="0.48.1-preview.0.1">
28+
<PackageReference Include="Spectre.Console" Version="0.48.1-preview.0.9" />
29+
<PackageReference Include="Spectre.Console.Analyzer" Version="0.48.1-preview.0.9">
3030
<PrivateAssets>all</PrivateAssets>
3131
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3232
</PackageReference>
33-
<PackageReference Include="Spectre.Console.Cli" Version="0.48.1-preview.0.1" />
33+
<PackageReference Include="Spectre.Console.Cli" Version="0.48.1-preview.0.9" />
34+
<PackageReference Include="Spectre.Console.ImageSharp" Version="0.48.1-preview.0.9" />
3435
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
3536
<PackageReference Include="System.Reactive" Version="6.0.1-preview.1" />
3637
</ItemGroup>
@@ -46,6 +47,9 @@
4647
<Reference Include="Kantan.Net">
4748
<HintPath>..\..\..\VSProjects\Kantan\Kantan.Net\bin\Release\net8.0\Kantan.Net.dll</HintPath>
4849
</Reference>
50+
<Reference Include="Novus">
51+
<HintPath>..\..\..\VSProjects\Novus\Novus\bin\Release\net8.0\Novus.dll</HintPath>
52+
</Reference>
4953
<!--
5054
<Reference Include="Novus">
5155
<HintPath>..\..\..\VSProjects\Novus\Novus\bin\Release\net8.0\Novus.dll</HintPath>

0 commit comments

Comments
 (0)