cmdutils

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

pacakge Cmdutils

Wraps around the ConfigManager library with additional postprocessing capabilities for output management when used with cli flags.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetReader

func GetReader(cmd *cobra.Command, inputpath string) (io.Reader, error)

func GetWriter

func GetWriter(outputpath string) (io.WriteCloser, error)

Types

type CmdUtils

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

func New

func New(confManager configManagerIface, logger log.ILogger, writer io.WriteCloser) *CmdUtils

func (*CmdUtils) GenerateFromCmd

func (c *CmdUtils) GenerateFromCmd(tokens []string) error

GenerateFromTokens is a helper cmd method to call from retrieve command

func (*CmdUtils) GenerateStrOut

func (c *CmdUtils) GenerateStrOut(input io.Reader, inputOutputIsSame bool) error

Generate a replaced string from string input command

returns a non empty string if move of temp file is required

func (*CmdUtils) UploadTokensWithVals

func (c *CmdUtils) UploadTokensWithVals(tokens map[string]string) error

UploadTokensWithVals takes in a map of key/value pairs and uploads them

type PostProcessor

type PostProcessor struct {
	ProcessedMap generator.ParsedMap
	Config       *config.GenVarsConfig
	// contains filtered or unexported fields
}

PostProcessor processes the rawMap and outputs the result depending on cmdline options

func (*PostProcessor) ConvertToExportVar

func (p *PostProcessor) ConvertToExportVar() []string

ConvertToExportVar assigns the k/v out as unix style export key=val pairs separated by `\n`

func (*PostProcessor) FlushOutToFile

func (p *PostProcessor) FlushOutToFile(w io.Writer) error

FlushOutToFile saves contents to file provided in the config input into the generator default location is ./app.env

can also be to stdout or another file location

func (*PostProcessor) StrToFile

func (p *PostProcessor) StrToFile(w io.Writer, str string) error

StrToFile writes a provided string to the writer

type WriterCloserWrapper

type WriterCloserWrapper struct {
	io.Writer
}

func (*WriterCloserWrapper) Close

func (swc *WriterCloserWrapper) Close() error

Jump to

Keyboard shortcuts

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