Skip to content
  •  
  •  
  •  
26 changes: 20 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ because it turns other people's test suites red.

## [Unreleased]

## [0.6.0-rc1] - 2026-11-18

### Breaking

- **The label drawn in a picture no longer states the size of the file.** It
Expand Down Expand Up @@ -263,6 +265,11 @@ because it turns other people's test suites red.

### Changed

- **Working out the smallest file of a picture takes half the time.** A
picture with its width and height set and `smallest` as its size was
compressed twice while the run worked out how small it can be, and is now
compressed once. `tfg preset show picture-sizes` and a dry run of the set
take about 0.7 s rather than 1.2 to 1.3 s. The files are the same.
- **Many pictures are ready to write several times sooner.** Before the
first file is written, every file is worked out, and a picture is drawn to
do it - now on every processor at once. On 16 threads,
Expand All @@ -281,11 +288,12 @@ because it turns other people's test suites red.
turn of the mouse wheel takes the window about 8 to 11 ms rather than 15 to
20 ms, inside the time of one screen refresh.
- **A value to type stands out from the words describing it.** In the
explanation behind a field, a value you type as it is - `screens` and `all`
for the groups of `picture-sizes`, `10mb` for a size, `{index:04}` in a file
name, `cccccc` for a colour - is drawn in a code typeface and its own colour.
The site shows it as code, and `tfg preset show` and `tfg formats` print it
between backticks.
explanation behind a field, each value you type as it is - the choices and
the default of a setting, its examples, and values such as `screens` and
`all` for the groups of `picture-sizes` - is drawn in a code typeface and
its own colour. The site shows them as code. The command line prints them
between backticks in `tfg formats`, `tfg preset show` and the list of a
preset's flags.
- **The mouse wheel scrolls the window as far as the system says.** One notch
moves three lines of text, or as many as Windows is set to under Mouse,
Lines to scroll at a time, where it moved about half as far before. A
Expand Down Expand Up @@ -380,6 +388,11 @@ because it turns other people's test suites red.

### Fixed

- **The title bar of the window is dark on Windows set to light apps.** The
window is always dark, and on a Windows set to light apps its title bar was
white. It is now dark there too, and stays dark when the Windows setting is
changed while the window is open. On macOS and Linux the title bar still
follows the system.
- **The smallest size a refusal names is one every file of the batch takes.**
Three 320x240 PNGs asked for at 1 B named the smallest size of the first
file, and that size was refused again, because each picture needs its own.
Expand Down Expand Up @@ -3203,7 +3216,8 @@ because it turns other people's test suites red.

Initial release.

[Unreleased]: https://github.com/donislawdev/TestingFilesGenerator/compare/v0.5.0...HEAD
[Unreleased]: https://github.com/donislawdev/TestingFilesGenerator/compare/v0.6.0-rc1...HEAD
[0.6.0-rc1]: https://github.com/donislawdev/TestingFilesGenerator/compare/v0.5.0...v0.6.0-rc1
[0.5.0]: https://github.com/donislawdev/TestingFilesGenerator/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/donislawdev/TestingFilesGenerator/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/donislawdev/TestingFilesGenerator/compare/v0.2.0...v0.3.0
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Arm. It holds the program from the release archive and nothing else, and it
runs with no network:

```
docker run --rm --network none -v "${PWD}:/work" ghcr.io/donislawdev/tfg:0.5.0 generate --format pdf --size 1mb
docker run --rm --network none -v "${PWD}:/work" ghcr.io/donislawdev/tfg:0.6.0-rc1 generate --format pdf --size 1mb
```

The files land in the current directory. On Linux add
Expand Down Expand Up @@ -779,7 +779,7 @@ interrupted. One entry per file:
```json
{
"manifest_version": "1.0",
"tool": { "name": "testing-files-generator", "version": "0.5.0" },
"tool": { "name": "testing-files-generator", "version": "0.6.0-rc1" },
"run": {
"id": "run_b359aa8d94",
"seed": 0,
Expand Down Expand Up @@ -906,7 +906,7 @@ On a Linux runner the Docker image needs no install step:

```yaml
- name: build the fixtures
run: docker run --rm --network none --user "$(id -u):$(id -g)" -v "$PWD:/work" ghcr.io/donislawdev/tfg:0.5.0 generate fixtures.yaml --out fixtures
run: docker run --rm --network none --user "$(id -u):$(id -g)" -v "$PWD:/work" ghcr.io/donislawdev/tfg:0.6.0-rc1 generate fixtures.yaml --out fixtures
```

Name the version rather than `latest`, so the same recipe gives the same bytes
Expand All @@ -926,7 +926,7 @@ names the SPDX predicate. On macOS this needs an Apple silicon runner, such as
env:
GH_TOKEN: ${{ github.token }}
run: |
version=0.5.0
version=0.6.0-rc1
arch=amd64
if [ "$RUNNER_ARCH" = ARM64 ]; then arch=arm64; fi
case "$RUNNER_OS" in
Expand Down
Binary file modified cmd/tfg-gui/rsrc_windows_amd64.syso
Binary file not shown.
Binary file modified cmd/tfg/rsrc_windows_amd64.syso
Binary file not shown.
8 changes: 4 additions & 4 deletions cmd/tfg/tfg.rc
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
1 ICON "../../internal/gui/icon/chickpea.ico"

1 VERSIONINFO
FILEVERSION 0,5,0,0
PRODUCTVERSION 0,5,0,0
FILEVERSION 0,6,0,0
PRODUCTVERSION 0,6,0,0
FILEOS 0x40004L
FILETYPE 0x1L
BEGIN
Expand All @@ -50,12 +50,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "DonislawDev"
VALUE "FileDescription", "Generates test files for QA, from the command line"
VALUE "FileVersion", "0.5.0"
VALUE "FileVersion", "0.6.0-rc1"
VALUE "InternalName", "tfg"
VALUE "LegalCopyright", "Copyright (C) 2026 DonislawDev. GNU GPL version 3."
VALUE "OriginalFilename", "tfg.exe"
VALUE "ProductName", "Testing Files Generator"
VALUE "ProductVersion", "0.5.0"
VALUE "ProductVersion", "0.6.0-rc1"
END
END
BLOCK "VarFileInfo"
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Usage:
Flags:
`)
fs.SetOutput(w)
fs.PrintDefaults()
printFlags(fs)
fs.SetOutput(errOut)
}
fs.Usage = func() { usage(errOut) }
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/damagecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ Usage:
Flags:
`)
fs.SetOutput(w)
fs.PrintDefaults()
printFlags(fs)
fs.SetOutput(errOut)
}

Expand Down
43 changes: 43 additions & 0 deletions internal/cli/flagusage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package cli

import (
"flag"
"fmt"
"strings"

"github.com/donislawdev/TestingFilesGenerator/internal/core"
)

// printFlags is fs.PrintDefaults with the backticks of every usage left as
// they are, written where fs writes.
//
// PrintDefaults takes the first word of a usage written between backticks for
// the name of the flag's value, prints it after the flag and drops the marks
// (flag.UnquoteUsage). No flag of ours names its value that way, and the
// usages of a preset's and a tool's settings mark the values a person types
// (core.Literal) - so a preset's groups printed as "-groups screens", with
// screens the one value left unmarked, measured on 2026-11-18
// (docs/HINT-VALUES-2026-11-18.md). The marks stand aside while the flags are
// printed and come back in what was printed.
func printFlags(fs *flag.FlagSet) {
out := fs.Output()
var printed strings.Builder
var marked []*flag.Flag
fs.VisitAll(func(f *flag.Flag) {
if strings.Contains(f.Usage, core.Backtick) {
f.Usage = strings.ReplaceAll(f.Usage, core.Backtick, markStandIn)
marked = append(marked, f)
}
})
fs.SetOutput(&printed)
fs.PrintDefaults()
fs.SetOutput(out)
for _, f := range marked {
f.Usage = strings.ReplaceAll(f.Usage, markStandIn, core.Backtick)
}
fmt.Fprint(out, strings.ReplaceAll(printed.String(), markStandIn, core.Backtick))
}

// markStandIn holds a backtick's place while PrintDefaults reads a usage - a
// character no usage carries, so putting the marks back finds only theirs.
const markStandIn = "\x00"
2 changes: 1 addition & 1 deletion internal/cli/formats.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Usage:
Flags:
`)
fs.SetOutput(w)
fs.PrintDefaults()
printFlags(fs)
fs.SetOutput(errOut)
}
fs.Usage = func() { usage(errOut) }
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Usage:
Flags:
`)
fs.SetOutput(w)
fs.PrintDefaults()
printFlags(fs)
fs.SetOutput(errOut)
}
// Pointed at wherever the set is currently writing rather than at errOut,
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/presetcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Usage:
Flags:
`)
fs.SetOutput(w)
fs.PrintDefaults()
printFlags(fs)
fs.SetOutput(errOut)
}
fs.Usage = func() { usage(errOut) }
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/recipecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func validateFlagSet(errOut io.Writer, v *validateFlags) (*flag.FlagSet, func(io
usage := func(w io.Writer) {
fmt.Fprint(w, "tfg validate - check a recipe and write nothing.\n\nUsage:\n tfg validate <recipe.yaml>\n\nFlags:\n")
fs.SetOutput(w)
fs.PrintDefaults()
printFlags(fs)
fs.SetOutput(errOut)
}
fs.Usage = func() { usage(errOut) }
Expand Down Expand Up @@ -311,7 +311,7 @@ Usage:
Flags:
`)
fs.SetOutput(w)
fs.PrintDefaults()
printFlags(fs)
fs.SetOutput(errOut)
}
fs.Usage = func() { usage(errOut) }
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Usage:
Flags:
`)
fs.SetOutput(w)
fs.PrintDefaults()
printFlags(fs)
fs.SetOutput(errOut)
}
fs.Usage = func() { usage(errOut) }
Expand Down
13 changes: 13 additions & 0 deletions internal/core/literal.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ func Pieces(s string) []Piece {
return out
}

// Literal marks value as one to type, for a description put together by the
// program - the choices and the default of a setting (format.Property.Allowed).
func Literal(value string) string { return Backtick + value + Backtick }

// LiteralEach is Literal of every value, in order.
func LiteralEach(values []string) []string {
out := make([]string, len(values))
for i, v := range values {
out[i] = Literal(v)
}
return out
}

// Literals is every value to type in a description, in order.
func Literals(s string) []string {
var out []string
Expand Down
102 changes: 102 additions & 0 deletions internal/format/allowed.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package format

import (
"fmt"
"strings"

"github.com/donislawdev/TestingFilesGenerator/internal/core"
)

// What a setting takes, said to a person looking at an empty field: the start
// of the explanation under it, which tfg formats prints and the window builds
// in its own words from the same parts. Beside format.go, which holds the
// refusal a value meets (Allows), rather than in it: the two say the same
// words, a guard reads them side by side, and format.go reached the ceiling
// on the length of a file when the values in this one were marked (O358).

// sizePhrase is what a size setting takes under an empty field, its example
// marked as a value to type (core.Literal).
//
// Allows says the same words, and until 2026-08-26 the two said it
// differently - "a size written the way any size is, such as 2mb or a plain
// byte count" against "a size such as 2mb, or a plain byte count". The other
// four kinds agree word for word, so size was the one place where the sentence
// a person reads depended on whether they had already typed something. O64,
// held by TestASettingIsDescribedTheSameWayEmptyOrRefused, which reads the two
// without the marks: a refusal is a sentence of the engine and carries none.
//
// The shorter half won: "written the way any size is" is a sentence about
// sizes rather than about this setting, and somebody who has just been refused
// needs the shape, not the provenance.
const sizePhrase = "a size such as `2mb`, or a plain byte count"

func (p Property) unitSuffix() string {
if p.Unit == "" {
return ""
}
return " of " + p.Unit
}

// Allowed says what this property accepts, as one phrase for a person.
//
// The values in it a person types as they are - each choice, the default, the
// examples - stand between backticks (core.Literal), which the window draws in
// the type of code, the site as code and the command line as written. The
// owner's decision of 2026-11-18 (O358, docs/HINT-VALUES-2026-11-18.md): the
// sentences under it marked them already, and the start of the same
// explanation did not.
//
// It lives here rather than beside a consumer because there are two of them and
// they cannot import each other. "tfg formats png" prints it in a list, and the
// window shows it under the field it drew from this same declaration - so a
// second copy would be two surfaces coming to describe one format differently,
// which is D1 in the place nobody thinks to compare.
//
// Near neighbour of Allows above, and deliberately not folded into it. Allows
// answers somebody who has already typed a wrong value and names the flag that
// would have taken a right one. This answers somebody looking at an empty field.
// The two phrasings agree today for every kind but size, and unifying them would
// change a message the command line already prints - a decision for the owner
// rather than a tidy up. Recorded as O64.
func (p Property) Allowed() string {
var what string
switch p.Kind {
case PropertyInt:
if p.Min != 0 || p.Max != 0 {
what = fmt.Sprintf("whole number%s from %d to %d", p.unitSuffix(), p.Min, p.Max)
} else {
what = "whole number" + p.unitSuffix()
}
case PropertyChoice:
what = "one of: " + strings.Join(core.LiteralEach(p.Choices), ", ")
case PropertyBool:
what = core.Literal("true") + " or " + core.Literal("false")
case PropertySize:
what = sizePhrase
case PropertyDuration:
what = p.durationPhrase()
default:
// A text setting describes itself with Shape or not at all. Saying
// "text" under a field is a word where a description should be.
what = p.Shape
}
if p.Default != "" && what == "" {
return "default " + core.Literal(p.Default)
}
if p.Default != "" {
what += ", default " + core.Literal(p.Default)
}
return what
}

// durationPhrase is what a length of time takes under an empty field: the
// refusal's own words without its first two (takesDuration), so an empty field
// and a refused one describe the setting identically, and the examples marked
// as values to type.
func (p Property) durationPhrase() string {
examples := core.Literal("10s") + ", " + core.Literal("1m30s") + " or " + core.Literal("500ms")
if p.Min == 0 && p.Max == 0 {
return "a length of time such as " + examples
}
return "a length of time from " + core.FormatDuration(p.Min) + " to " + core.FormatDuration(p.Max) + ", such as " + examples
}
2 changes: 1 addition & 1 deletion internal/format/archive/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const (
// archive's and a message's alike. Given by example rather than by the
// command that lists formats, because a window has no command line beside
// the box and does have a list of formats at its top.
FormatShape = "the id of a format, such as png or csv"
FormatShape = "the id of a format, such as `png` or `csv`"

defaultEntries = 1

Expand Down
Loading
Loading