columnize

package
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(lines []string, config *Config) string

Format is the public-facing interface that takes a list of strings and returns nicely aligned column-formatted text.

func SimpleFormat

func SimpleFormat(lines []string) string

SimpleFormat is a convenience function to format text with the defaults.

Types

type Config

type Config struct {
	// The string by which the lines of input will be split.
	Delim string

	// The string by which columns of output will be separated.
	Glue string

	// The string by which columns of output will be prefixed.
	Prefix string

	// A replacement string to replace empty fields.
	Empty string

	// NoTrim disables automatic trimming of inputs.
	NoTrim bool
}

Config can be used to tune certain parameters which affect the way in which Columnize will format output text.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a *Config with default values.

func MergeConfig

func MergeConfig(a, b *Config) *Config

MergeConfig merges two config objects together and returns the resulting configuration. Values from the right take precedence over the left side.

Jump to

Keyboard shortcuts

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