Voila forthebadge forthebadge

Contributor Covenant GitHub license GitHub release Linux build MacOS build Windows build

Voila is a domain-specific language designed for doing complex operations to folders & files. It is based on a CLI tool, although you can write your Voila code and do something like this voila DIRECTORY "$(cat operations.vla)". Voila is mainly tested in Linux, so should work better in *nix (Linux, *BSD, macOS, etc) than in Windows-based operating systems.

Syntax

voila DIRECTORY "<@VARIABLE | STRING | #REGEXP#> OPERATOR <@VARIABLE | STRING | #REGEXP#> [|| | && ANOTHER_CONDITIONAL ...] {OPERATION1-CYCLE-1(ARG1 ARG1, ARG2) OPERATION2-CYCLE-1(ARG1 ARG2) ...; OPERATION1-CYCLE-2(ARG1, ARG2 ARG2, ARG3)...}"

Voila's syntax is composed of a traditional conditional/multi-conditional statement, followed by the operations, delimited within curly brackets. These are separated into cycles. A cycle is an iteration between all directory files, the operations in every cycle are executed in parallel, and cycles are executed consecutively. cycles are separated with ;, and operations/functions arguments are separated with ,. Variables' prefix is @, and its value changes to the file that is evaluating. Regular expressions are delimited between #. For a more intuitive explanation, go to the "Examples" section.

These are the available conditional operators: * ==: true if the first value matches the second * !=: true if the first value doesn't match the second * >: true if the first value is greater than the second * >=: true if the first value is equal or greater than the second * <: true if the first value is less than the second * <=: true if the first value is equal or less than the second * ~=: true if the a value matches the regex provided in the other value * ~!: true if the a value doesn't match the regex provided in the other value

These are the available variables: * name: filename * path: absolute path * parent: absolute path to file's directory * size=tb: file size in terabytes (2 decimals) * size=gb: file size in gigabytes (2 decimals) * size=mb: file size in megabytes (2 decimals) * size=kb: file size in kilobytes (2 decimals) * size=bs: file size bytes (no decimals) * empty: true if the file size is less than 1 byte (else false) * readonly: true if the file is ro (else false) * sha256sum: sha256 checksum * md5sum: md5 checksum this variable might be removed in the future, md5 is completely broken * ownerID: file owner ID (unix-only) * creation=date: date of file creation (yyyy-mm-dd) * creation=hour: hour of file creation (hh:mm:ss) * lastChange=date: date of the last modification to the file (yyyy-mm-dd) * lastChange=hour: hour of the last modification to the file (hh:mm:ss) * lastAccess=date: date of the last access to the file (yyyy-mm-dd) * lastAccess=hour: hour of the last access to the file (hh:mm:ss)

These are the available operations/functions: * print: prints something to the terminal (not to the printer lol) * create: creates a file, with its content as second argument * mkdir: cretes a folder/directory * delete: deletes file/directory * move: moves a file or a folder/directory * copy: copies a file or a folder/directory * shell: gives a command to the Bourne Shell (sh) in Unix systems (like Linux or macOS), and a command to PowerShell (powershell) in Windows systems. Exists for doing things Voila functions can't, for example, send a dbus message.

Examples

CLI flags

Error types

Voila provides 2 main error types: * RUNTIME ERROR: An error that occurred while running the Voila code. Code might have been already executed, and other code might not. * PARSE ERROR: This error is triggered by a syntax error during the construction of the AST (what reads the interpreter), so no code was executed during the raise of this error.

Installation

You can install voila by cloning the repository and compiling or by cargo install voila. I have planned to provide prebuilt binaries soon.

Submitting...

Message from the author

Voila has been coded & tested by only one person, so don't expect it to be perfect. I'm looking for more people interested in maintaining Voila and helping out, if you're interested, DM me on discord (NOT-Guillem#8042). Voila's discord server is this