shilangyu / scoop-search

Fast `scoop search` drop-in replacement 🚀
MIT License
290 stars 10 forks source link

Scoop-Search does not return powershell objects like the original command #67

Open Alfamari opened 1 month ago

Alfamari commented 1 month ago

Description

Following the instructions of: Behaves just like scoop search and returns identical output. If any differences are found please open an issue.

Apart from being visually different, it also loses its ability for powershell object filtering/manipulation.

wezterm-gui_401m3xovq8

wezterm-gui_3WISRJT350

Logs

The offending command causing the error with the $env:SCOOP_SEARCH_VERBOSE=1 env var set:

Output ```Commandline arguments: args.ParsedArgs{ .query = { 112, 121, 116, 104, 111, 110 }, .hook = false, .allocator = mem.Allocator{ .ptr = anyopaque@87975ff080, .vtable = mem.Allocator.VTable{ .alloc = fn (*anyopaque, usize, u8, usize) ?[*]u8@3e20d0, .resize = fn (*anyopaque, []u8, u8, usize, usize) bool@3e2170, .free = fn (*anyopaque, []u8, u8, usize) void@3e21c0 } } } env:SCOOP= env:USERPROFILE=C:\Users\alfamari env:XDG_CONFIG_HOME= Scoop config file path: C:\Users\alfamari/.config/scoop/config.json Scoop config file contents: { "last_update": "2024-09-20T01:04:17.4222547-05:00", "scoop_repo": "https://github.com/ScoopInstaller/Scoop", "scoop_branch": "master", "root_path": "D:\\Program Files (x86)\\Scoop", "global_path": "D:\\Program Files (x86)\\Scoop", "aria2-enabled": true } Scoop home: D:\Program Files (x86)\Scoop Found bucket: D:\Program Files (x86)\Scoop/buckets/extras Worker count: 8 Found 5 matches Found bucket: D:\Program Files (x86)\Scoop/buckets/main Worker count: 8 Found 2 matches Done searching 'extras' bucket: anaconda3 (2024.06-1) --> includes 'python.exe' fontforge (20230101) --> includes 'ffpython.exe' mambaforge (24.7.1-0) --> includes 'python.exe' miniconda3 (24.7.1-0) --> includes 'python.exe' paraview (5.13.0) --> includes 'pvpython.exe' 'main' bucket: python (3.12.6) winpython (3.12.4.1) ```
Alfamari commented 1 month ago

Additionally the output for returning no results is very slightly different. (Honestly, doesn't really seem noteworthy but I thought I'd document the difference and leave it up to the developer.)

wezterm-gui_1AzxlzLxHY

shilangyu commented 1 week ago

In the past, scoop would also output pure strings and not powershell objects. At some point I tried to see how a non-powershell program can output powershell objects, but I did not find the solution. Does anyone know how this is done?

Alfamari commented 1 week ago

Well if it can output into a structured format, powershell does have ways of converting raw strings into objects:

Easiest method using standardized formats: ConvertFrom-Json (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Learn ConvertFrom-Csv (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Learn

Can utilize customized non-standardized structured formats but much more annoying: ConvertFrom-String (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Learn ConvertFrom-StringData (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Learn

shilangyu commented 1 week ago

I don't think that would be wanted though. If this were to be implemented I think it should directly output powershell objects