CLI

Talks about:

The command line tool generates the same code as the build plugins, without being part of a build. Use it when your project builds with something YoSQL has no plugin for, or to generate code once and commit the result.

Getting it

Each release publishes two kinds of archive:

Unpack it and put the yosql binary, or the bin/yosql script, on your PATH. Both archives are covered by the signed SHA256SUMS — see verifying a download .

Starting from something

In a project with no statements yet, init writes the three files that make a first run possible — a statement, the record it builds, and an arguments file tying the directories together:

yosql init
yosql generate @yosql.args

That leaves a TenantRepository with a findTenant and an insertTenant to delete or rename. --package sets the package to write in, --directory the project to write into, and files that are already there are kept unless --force says otherwise.

Using it

yosql generate --files-input-base-directory=/path/to/your/sql/files

That reads every .sql file under the directory and writes Java beside it. Option names follow the configuration groups: a setting shown there as files.outputBaseDirectory is --files-output-base-directory here. yosql generate --help lists all of them.

Options can also come from a file, which is easier to keep in version control than a long command:

yosql generate @yosql.args

where yosql.args holds one option per line:

--files-input-base-directory=src/main/yosql
--files-output-base-directory=src/main/java
--repositories-base-package-name=com.example.persistence