Help us shape the future of Go! Take the 2026 Go Developer Survey

formatting

package
v0.100.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFormatFlag

func AddFormatFlag(cmd *cobra.Command, format *Format)

AddFormatFlag registers --format / -f for render format (table, json, yaml, names, rel-paths, abs-paths).

func GetRelativeAndAbsolutePaths added in v0.85.0

func GetRelativeAndAbsolutePaths(absFilePath, catalogDir string) (relativePath, absolutePath string, err error)

GetRelativeAndAbsolutePaths returns catalog-relative and clean absolute paths for given absolute catalog resource file path.

func RenderAbsolutePaths added in v0.85.0

func RenderAbsolutePaths(writer io.Writer, absFilePaths []string) error

RenderAbsolutePaths writes all paths as absolute paths on different lines.

func RenderJson

func RenderJson(writer io.Writer, value any) error

func RenderNames

func RenderNames[T Named](writer io.Writer, items []T) error

func RenderRelativePaths added in v0.85.0

func RenderRelativePaths(writer io.Writer, absFilePaths []string, catalogDir string) error

RenderRelativePaths writes all paths as catalog-relative paths on different lines.

func RenderYaml

func RenderYaml(writer io.Writer, value any) error

Types

type Format

type Format string
const (
	FormatTable    Format = "table"
	FormatJson     Format = "json"
	FormatYaml     Format = "yaml"
	FormatNames    Format = "names"
	FormatRelPaths Format = "rel-paths"
	FormatAbsPaths Format = "abs-paths"
)

type Named

type Named interface {
	GetName() string
}

Jump to

Keyboard shortcuts

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