Hacker News new | ask | show | jobs
by rtpg 982 days ago
One thing that's cool with Nushell is being able to wrap wrappers around existing commandline tools to get structured output (so a wrapper around `git branch` could give me structured data).

What I kind of want to go along with this is a (for the lack of a better word) query planner. Let me query structured data, but only pull in stuff as I need it, lazily. That way my structured data can be very detailed, but I only end up pulling the data I need on each iteration. That avoids pulling _everything_ from disk in structured wrappers.

There's probably a nice middle ground here but it's the one thing that's holding me back from writing a _lot_ of very detailed wrapper code for Nushell and the like.

1 comments

> That avoids pulling _everything_ from disk in structured wrappers.

This is only really possible if the command you're wrapping allows filtering early on.

Something like kubernetes allowing to retreiving info about pods in certain states, instead of retrieving all pods and filtering afterwards.

Powershell puts a strong emphasis on this "filtering left" concept, that's why you have things like "gci" ("ls" equivalent), allowing you to pre-filter file types/names before a "where" clause, avoiding reading a lot of data.

Sorry, I wasn’t clear here. I’m not talking about limiting the number of entries, but about limiting the amount of data pulled per entry. Just like how a query planner in an RDBMS ends up only pulling relevant columns from disk.