readerly works next to the tools a CLI already has. It doesn't parse your commands, run your tests or render Markdown. Each page here shows where it meets one of them, with examples that ran against the source.
- GitHub Actions. Detects the runner from
GITHUB_ACTIONS, printstext, and adds::errorand::warningannotations on stderr, at most 10 of each. - Argument parsers.
readerFlags(argv)takes the shared flags and leavesrestfornode:utilparseArgs, cac or your own parser. - Testing your CLI. A fake
Ioruns one command as a terminal, an agent, GitHub Actions and--format jsonin the same test file. - Progress.
out.progress(label)draws a live bar on a terminal, prints a line every 5 seconds in CI and pipes, and prints nothing for agents and JSON. - Markdown answers.
out.write()takes an answer the tool rendered itself, such as Markdown through@comark/ansifor a person and as is for everyone else. - nostics.
nosticsReporter(out)sends nostics diagnostics tocreateOutas records, without a dependency on nostics.
Typical setups
Section titled "Typical setups"- A linter or checker.
createOutwithout.diagnostic(), annotations on GitHub Actions, and goldens per reader in your tests. - A tool with subcommands. cac or
parseArgsfor the commands,readerFlagsfirst, andprocess.exitCode = await command(argv). - A docs or explain command.
out.write()with Markdown, rendered only whenout.profile.formatistext.