Commands
Every command of tfg with every flag it takes. This page is read from the program's own
help when the page is built, so it says what the program says: tfg <command> --help
prints the same in your terminal.
| Command | What it does |
|---|---|
tfg generate | Produce files. |
tfg validate | Check a recipe and write nothing. |
tfg verify | Check that a directory still matches a manifest. |
tfg cleanup | Remove the files a manifest lists. |
tfg recipe fmt | Print a recipe in its settled shape, comments kept. |
tfg preset | Build a set of files from a named test question. |
tfg formats | List the formats this build supports. |
tfg damage | List the ways this build can break a file on purpose. |
tfg tool | Small things to do with files you already have. |
tfg version | Print the tool version. |
tfg license | Print the licence and what it means for generated files. |
A flag is written with two dashes, as --count 10, or with one. A flag that takes no value
is on when it is there. Every exit code is at the end of this page.
tfg generate
Produce files.
tfg generate <recipe.yaml> [flags] settings come from the file
tfg generate --format txt --size 1mb settings come from the flags
| Flag | Default | What it does |
|---|---|---|
--boundary string |
three files around a limit: one byte under it, the limit itself, one byte over | |
--clean |
turn off the self describing label | |
--count int |
1 |
how many files to produce |
--damage value |
break the files on purpose, repeatable and applied in order: --damage zero-head, or --damage zero-head:bytes=16. This build has: append-junk, truncate, zero-head. Run "tfg damage" for what each one does | |
--dry-run |
count and show, write nothing at all | |
--expected string |
declared expectation: accept, reject, sanitize or unspecified | |
--expected-reason string |
why that outcome is expected, from the closed list. Run with an unknown value to see it | |
--format string |
format of the files to produce, for example txt | |
--id string |
files |
target id, the anchor the seeds are derived from |
--json |
write the manifest to standard output | |
--memory value |
how much memory this run may use: auto (half of what this machine gives the program), a size such as 8gb, or off for no limit. Pictures wait for room rather than all being held at once, and a plan larger than this is refused before anything is written. When a run gets close to this amount, the program frees memory more often, which makes the run slower. A run that needs more memory than this still gets it. Under auto, a plan of up to 2.0 GB is never refused | |
--name string |
name template, for example invoice_{index:04}.txt | |
--number-if-taken |
when --out already holds names this run would write, an earlier run's manifest above all, give every name of this run a number such as -2 rather than stopping. Nothing already there is changed. Without it such a run stops with exit code 5 | |
--out string |
. |
directory to write into |
--preset string |
build the set a named test question calls for. Run "tfg preset list" to see them | |
--seed int |
run seed, the same seed gives the same bytes | |
--send-as string |
the name to give the file to your system under, when it is one no disk stores, for example ../climbed_out.jpg. The file keeps its own name here and the manifest carries this one | |
--set value |
format property, repeatable: --set width=1920 --set height=1080 | |
--size string |
exact size of each file. Units count in 1024s, so 10mb is 10485760 bytes. Also accepts a plain byte count, or smallest for a picture with its width and height set | |
--size-range string |
a size drawn from a range for each file, as 1kb-8kb. The draw comes from the seed, so the same seed gives the same sizes |
tfg validate
Check a recipe and write nothing.
tfg validate <recipe.yaml>
| Flag | Default | What it does |
|---|---|---|
--json |
write the result as JSON, with every problem separately | |
--memory value |
how much memory this run may use: auto (half of what this machine gives the program), a size such as 8gb, or off for no limit. Pictures wait for room rather than all being held at once, and a plan larger than this is refused before anything is written. When a run gets close to this amount, the program frees memory more often, which makes the run slower. A run that needs more memory than this still gets it. Under auto, a plan of up to 2.0 GB is never refused |
tfg verify
Check that a directory still matches a manifest.
Reports files that are missing, files nobody asked for, and files whose content has changed. The directory is always a local one.
tfg verify <manifest.json> [--against <dir>]
| Flag | Default | What it does |
|---|---|---|
--against string |
directory to check. Defaults to the directory holding the manifest | |
--json |
write the report to stdout as JSON | |
--memory value |
how much memory checking may use: auto (half of what this machine gives the program), a size such as 8gb, or off for no limit. A manifest listing more files than that can check is refused before any file is looked at. When checking gets close to this amount, the program frees memory more often, which makes it slower |
tfg cleanup
Remove the files a manifest lists.
Removes what the manifest lists and nothing else. Without --yes it deletes nothing and prints what it would remove. A file whose content has changed since it was written is left alone and reported, because it may not be ours.
tfg cleanup <manifest.json> [--yes]
| Flag | Default | What it does |
|---|---|---|
--against string |
directory to clean. Defaults to the directory holding the manifest | |
--force |
remove files whose content has changed since they were written | |
--json |
write the report as JSON instead of prose | |
--memory value |
how much memory checking may use: auto (half of what this machine gives the program), a size such as 8gb, or off for no limit. A manifest listing more files than that can check is refused before any file is looked at. When checking gets close to this amount, the program frees memory more often, which makes it slower | |
--with-manifest |
remove the manifest and the instructions beside it as well, once every file it lists is gone | |
--yes |
actually remove the files. Without this nothing is deleted and the list is printed |
tfg recipe fmt
Print a recipe in its settled shape, comments kept.
This settles the layout of a file. It does not check that the recipe makes sense - a file with a key nobody recognises or a format that does not exist still has a settled shape, and this will print it. Run "tfg validate" for that, and run both if you are checking recipes before a commit.
tfg recipe fmt <recipe.yaml>
| Flag | Default | What it does |
|---|---|---|
--check |
print nothing and end with code 3 when the layout is not settled. It says nothing about whether the recipe is valid - use tfg validate for that | |
-w |
write the result back to the file instead of printing it |
tfg preset
Build a set of files from a named test question.
tfg preset list what this build offers
tfg preset show <id> what it takes and what it would produce
tfg preset eject <id> -o my.yaml the recipe it stands for, to edit
A preset is a recipe with a name. Ejecting one gives back an ordinary recipe file, so nothing here is a closed box.
Run "tfg generate --preset <id>" to produce the files.
tfg formats
List the formats this build supports.
Says three things a request depends on and that nobody can guess: how faithful the file will be, whether it repeats to the byte, and how small it can go.
tfg formats
tfg formats --json
| Flag | Default | What it does |
|---|---|---|
--json |
write the list as JSON to standard output |
tfg damage
List the ways this build can break a file on purpose.
A damaged file comes out exactly the size you asked for. Where the damage breaks the rules of the format, the manifest expects the file to be rejected. Where readers differ - a text cut short is still text - it says the outcome depends on your system, and why. Use them with "tfg generate --damage <id>" or with the damage key of a recipe.
tfg damage
tfg damage --json
tfg damage <id>
| Flag | Default | What it does |
|---|---|---|
--json |
write the list as JSON to standard output |
tfg tool
Small things to do with files you already have.
tfg tool list the tools this build has
tfg tool show <id> what one tool works on and takes
tfg tool <id> <path> [flags] run it
Every tool is also on the Tools tab of the window, with the same settings.
tfg version
Print the tool version.
tfg license
Print the licence and what it means for generated files.
Exit codes
Every ending has a code of its own, so a script or a pipeline can tell them apart. Output meant for a program goes to standard output, and a run that fails prints nothing there. The meaning of a code never changes within a major version.
| Code | Meaning |
|---|---|
0 |
Everything worked. |
1 |
An unexpected error inside the tool. |
2 |
Wrong command or flag. |
3 |
The recipe is not valid. |
4 |
The format cannot do what was asked. |
5 |
A read or a write failed. |
6 |
Not enough disk space. |
7 |
verify found a mismatch. |
8 |
The run finished but not everything was produced. |
130 |
Interrupted with Ctrl+C. |
143 |
Stopped by a signal, which is what a CI timeout looks like. |
A run stopped with Ctrl+C still leaves a manifest and never a half written file, so the next run
can clean up after it. In PowerShell, end a script with exit $LASTEXITCODE, because a
.ps1 file does not pass the code of a program on by itself. More in
Test files in CI.