helpgolden

package
v3.0.0-alpha.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package helpgolden renders what tt prints for help and completion, for tests that pin it against a golden file: the --help of every command, the bash completion script and the completions of the first word.

The rendering takes the command tree from a function, so that every way of assembling tt can be compared against the same golden file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(t *testing.T, path, got string, update bool)

Compare compares got with the golden file at path, or rewrites the file with got when update is set.

func Render

func Render(t *testing.T, newRoot NewRoot) string

Render renders the help of every command of the tree newRoot builds, the bash completion script and the completion candidates for the first word.

func RenderHelp

func RenderHelp(t *testing.T, newRoot NewRoot, header string, paths ...[]string) string

RenderHelp renders the --help of the commands at paths, each given by the names from the root down - none for the root - under header, each of its lines a comment.

Types

type NewRoot

type NewRoot func(t *testing.T) *cobra.Command

NewRoot builds the command tree the way tt does before it runs a command, with no external modules, and makes it the process's root. It is called once per command line rendered.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL