Bringing a portable SQL like syntax to our filesystem.
Bringing SQL to our filesystem.
Termsequel, is an ideia that I have been thought a time ago(since, 2018 I guess), but, I had no ideia in how to implement it.
This section shows some examples of termsequel use …
Some useful information before:
. Means the current working directory
../ Means the parent directory of the current working directory
../.. Means the parent directory of the parent directory of the current working directory
./<SOME_DIRECTORY> Means the relative path of a directory
R Means read permission
W Means write permission
X Means execute permission
$<NAME> Means a variable
Note: In the follow examples, we use the SQL format syntax for simplicity and pretty examples. When using Termsequel, you will need to provide the binary name, and the SQL instruction must be inside quotes!
Example: Correct usage of Termsequel
$ termsequel 'SQL_INSTRUCTION'
To see the columns that are available on your binary, type:
$ termsequel -h
Some basic examples of Termsequel.
Example: Getting the name and size of a file in the current working directory.
SELECT NAME, SIZE FROM .
Example: Getting .txt
files in the current working directory.
SELECT NAME FROM . WHERE NAME ENDS_WITH .txt
Example: Getting files bigger than 1500 bytes.
SELECT NAME, SIZE FROM . WHERE SIZE > 1500
Some advanced examples of Termsequel.
Example: Getting files from parent directory whose owner has execution permission.
SELECT NAME, OWNER_PERMISSIONS FROM ../ WHERE OWNER_PERMISSIONS CONTAINS X
Example: Getting files from user home directory that ends with .pdf
and the owner has execution permission …
SELECT NAME, ABSOLUTE_PATH FROM $HOME WHERE NAME ENDS_WITH .pdf AND OWNER_PERMISSION CONTAINS X
Example: Select from directory that user do not has full access(for example, the /tmp directory).
SELECT * FROM /tmp
-- This might return some lines with error information, something like: Could not get the real path of <file>
-- this happens, because, the user do not have read access to this file.
Example: You can ignore error messages, if you want, but, you’ll need the help from your operating system …
$ termsequel 'SELECT * FROM /tmp' 2>/dev/null
# When an error occurr, we print it to the stderr buffer ...
# so, you can ignore those error messages redirecting them to null(special device), or, to a log file ...
The wiki page contains the documentation of the termsequel.
Additional information about compilers, CMake, operating systems can be found there …
As an open source project, we need to mantain ourselfs motivated … Of couse, sometimes, we lost the motivation, and this is a normal thing … I do not want money for this project, do something else with your money … Buy a thing for you, your mummy etc … One thing, that you can help, is to give a star … With this, I know that I am helping someone around the world, and, this motivates me to continue …
A special thanks to the people who give an star …