utils

package
v0.0.0-...-ac9356b Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClusterProfileToShortName

func ClusterProfileToShortName(annotation string) (string, error)

func Diff

func Diff(a, b []byte, fileName string) string

Diff returns a string containing the diff between the two strings. This is equivalent to running `git diff` on the two strings.

func EscapeForLiteral

func EscapeForLiteral(in string) string

EscapeForLiteral escapes common characters so they render properly

func GetPathPrefix

func GetPathPrefix(wd, path, packagePath string) (string, error)

GetPathPrefix calculates the pathPrefix that needs to be trimmed from the output file. The generator will generate the output file to the current working directory plus the package path name. This function calculates what is needed to be trimmed from the package path name to make sure the output ends up in the correct directory. Eg. if the package is github.com/openshift.io/api/machine/v1,

  • the current working directory is /home/user/go/src, then the path would be github.com/openshift.io/api/machine/v1 and so the output would be the empty string.
  • the current working directory is /home/user/go/src/github.com/openshift.io/api, then the path would be machine/v1 and so the output would be github.com/openshift.io/api.

func HasClusterProfilePreference

func HasClusterProfilePreference(annotations map[string]string) bool

func NewGengoJSONFile

func NewGengoJSONFile() gengogenerator.FileType

Types

type AggregatePrinter

type AggregatePrinter struct {
	// contains filtered or unexported fields
}

AggregatePrinter is an error wrapper that prints out aggregate and wrapped errors as individual errors in individual lines.

func NewAggregatePrinter

func NewAggregatePrinter(err error) AggregatePrinter

NewAggregatePrinter creates a new Aggregate error.

func (AggregatePrinter) Error

func (a AggregatePrinter) Error() string

Error prints the error out as a string. It unwraps wrapped errors and iterates over aggregate errors to print errors on invidividual lines.

type Markdown

type Markdown struct {
	// contains filtered or unexported fields
}

func NewMarkdown

func NewMarkdown(topTitle string) *Markdown

func (*Markdown) Bytes

func (m *Markdown) Bytes() []byte

func (*Markdown) EndTableRow

func (m *Markdown) EndTableRow()

func (*Markdown) Exact

func (m *Markdown) Exact(text string)

func (*Markdown) ExactBytes

func (m *Markdown) ExactBytes() []byte

ExactBytes returns markdown with table of contents or title. Useful for embedding.

func (*Markdown) ExactText

func (m *Markdown) ExactText(text string)

func (*Markdown) ExactTextf

func (m *Markdown) ExactTextf(format string, args ...any)

func (*Markdown) NewOrderedListItem

func (m *Markdown) NewOrderedListItem()

func (*Markdown) NextTableColumn

func (m *Markdown) NextTableColumn()

func (*Markdown) OrderedListEnd

func (m *Markdown) OrderedListEnd()

func (*Markdown) OrderedListStart

func (m *Markdown) OrderedListStart()

func (*Markdown) Text

func (m *Markdown) Text(text string)

func (*Markdown) Textf

func (m *Markdown) Textf(format string, args ...any)

func (*Markdown) Title

func (m *Markdown) Title(level int, text string)

func (*Markdown) UnlistedTitle

func (m *Markdown) UnlistedTitle(level int, text string)

Jump to

Keyboard shortcuts

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