Advanced Usage

codescan is a go library that ships with a few utility commands. These commands are thin wrappers around the library’s scanner.

The library’s behavior is tuned by fields on codescan.Options. The commands — genspec, genspec-tui and genspec-wasi — register one flag per field over that same struct.

So every available knob has three spellings for one meaning:

SpellingLooks like
A Go fieldopts.NameFromTags = []string{"form", "json"}
A command-line flaggenspec -name-from-tags form,json
A configuration keyemit:
  name-from-tags: [form, json]

The mapping is mechanical: a flag is the kebab-case of the field it writes, without exception, and a configuration key is the flag, spelled exactly as on the command line, under the section that flag belongs to.

That is why genspec -h doubles as the reference for the file — and why the one reference below serves all three.

Note

The commands do not each declare that surface: it is written once, and a guard fails the build when an option lands with no flag — so a knob added to the library is reachable from all of them at the same moment. How that is arranged is in The commands.