jhspetersson / fselect

Find files with SQL-like queries
https://fselect.rocks
Apache License 2.0
4.02k stars 85 forks source link

Feature request: allow "from" at end of query #110

Closed notfed closed 2 years ago

notfed commented 3 years ago

Please allow "from" to come at the end of the query (yes, breaking the SQL standard).

Why? Unlike database queries, fselect commands can be re-used against different directories. Putting it at the end makes it easier to quickly re-use a query for a different directory. It would also make it possible to store an fselect query as a shell alias.

For example,

alias count-git-repos='fselect count(*) where name = '.git' from'

I can then do:

count-git-repos ~/repos

I realize I can currently do this:

function count() { fselect "count(*)" from "$1" "where name = '.git'" }

But to me the alias feels cleaner, and simpler to understand and to re-use.