core

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckoutToExistingBranch

func CheckoutToExistingBranch(branch, path string) bool

func CheckoutToNewBranch

func CheckoutToNewBranch(branch, path string) bool

func DoesGitRepoExist

func DoesGitRepoExist(path string) bool

func FinalizeUpdates

func FinalizeUpdates(cookbookName, path, version string, ui UI) bool

func GetConfigPath

func GetConfigPath(fileName string) string

GetConfigPath will return default config path from current dir

func GetCurrentBranch

func GetCurrentBranch(path string) string

func GetDefaultConfigPath

func GetDefaultConfigPath() string

GetDefaultConfigPath will return default config path from /etc/chef

func GetDefaultCookbookPath added in v0.0.4

func GetDefaultCookbookPath() (string, error)

GetDefaultCookbookPath will return default config path from /etc/chef

func IsBranchExists

func IsBranchExists(branch, path string) bool

func IsUnCommittedWorkPresent

func IsUnCommittedWorkPresent(path string) (bool, string)

func MergeUpdates

func MergeUpdates(cookbookName, path, version string, ui UI)

func SanityCheck

func SanityCheck(path, defaultBranch string, useCurrentBranch bool, ui UI) bool

func UpdateCount

func UpdateCount(cookbookName, path string) int

Types

type Config

type Config struct {
	ServerUrl       string `json:"server_url" yaml:"server_url"`
	ClientKey       string `json:"client_key" yaml:"client_key"`
	ConfigFile      string `json:"config_file" yaml:"config_file"`
	DefaultValue    bool   `json:"default_value" yaml:"default_value"`
	Format          string `json:"format" yaml:"format"`
	SuperMarketSite string `json:"super_market_site" yaml:"super_market_site"`
	Version         string `json:"version" yaml:"version"`
	Yes             bool   `json:"yes" yaml:"yes"`
	WithUri         string `json:"with_uri" yaml:"with_uri"`
}

Config this will contain all configuration required by chef command like chef infra server url, Chef zero host url and port Chef Infra Server client key format etc ...

func (*Config) LoadConfig

func (c *Config) LoadConfig(fileName string) (string, string)

LoadConfig will load default config from client.rb at default path or in current dir

type JsonPresenter

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

func NewJsonPresenter

func NewJsonPresenter(separator, attr, runList string) *JsonPresenter

func (*JsonPresenter) DisplayCookBook

func (jp *JsonPresenter) DisplayCookBook(data interface{}) interface{}

DisplayCookBook will display cookbook in given format

func (*JsonPresenter) Format

func (jp *JsonPresenter) Format(data interface{}) string

Format will format in pretty print

func (*JsonPresenter) FormatSubSet

func (jp *JsonPresenter) FormatSubSet(data string) string

FormatSubSet will separate data on give input

func (*JsonPresenter) ListDisplay

func (jp *JsonPresenter) ListDisplay(config Config, data interface{}) interface{}

ListDisplay list display sort tje list and print result

func (*JsonPresenter) NameOrID

func (jp *JsonPresenter) NameOrID(data map[string]interface{}) interface{}

NameOrID will print name or id

func (*JsonPresenter) NestedValue

func (jp *JsonPresenter) NestedValue(data interface{}) interface{}

NestedValue will get all nested value matching to attr

func (*JsonPresenter) Summarize

func (jp *JsonPresenter) Summarize(data string) string

Summarize Summarize given input

type Presenter

type Presenter interface {
	Format(data interface{}) string
	Summarize(data string) string
	ListDisplay(config Config, data interface{}) interface{}
	FormatSubSet(data string) string
	NameOrID(data map[string]interface{}) interface{}
	NestedValue(data interface{}) interface{}
	DisplayCookBook(data interface{}) interface{}
}

type TextPresenter

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

func NewTextPresenter

func NewTextPresenter(separator, attr, runList string) *TextPresenter

func (*TextPresenter) DisplayCookBook

func (tp *TextPresenter) DisplayCookBook(data interface{}) interface{}

DisplayCookBook will display cookbook in given format

func (*TextPresenter) Format

func (tp *TextPresenter) Format(data interface{}) string

Format will format in pretty print

func (*TextPresenter) FormatSubSet

func (tp *TextPresenter) FormatSubSet(data string) string

FormatSubSet will separate data on give input

func (*TextPresenter) ListDisplay

func (tp *TextPresenter) ListDisplay(config Config, data interface{}) interface{}

ListDisplay list display sort tje list and print result

func (*TextPresenter) NameOrID

func (tp *TextPresenter) NameOrID(data map[string]interface{}) interface{}

NameOrID will print name or id

func (*TextPresenter) NestedValue

func (tp *TextPresenter) NestedValue(data interface{}) interface{}

NestedValue will get all nested value matching to attr

func (*TextPresenter) Summarize

func (tp *TextPresenter) Summarize(data string) string

Summarize Summarize given input

type UI

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

UI will used to display current output in format and color

func NewUI

func NewUI(color, format, logLevel, fieldSep string) *UI

NewUI return new UI object

func (*UI) AskQuestion

func (u *UI) AskQuestion(config Config, question string, opts map[string]string) (ans string)

func (*UI) ColorMsg

func (u *UI) ColorMsg(message, color string) string

func (*UI) Confirm

func (u *UI) Confirm(config Config, question string, appendInstructions bool, defaultChoice int)

Confirm ask user question based on that program continue

func (*UI) ConfirmWithoutExit

func (u *UI) ConfirmWithoutExit(config Config, question string, appendInstructions bool, defaultChoice int) bool

ConfirmWithoutExit ask user question based on that program continue

func (*UI) ConfirmationInstructions

func (u *UI) ConfirmationInstructions(defaultChoice int) string

ConfirmationInstructions instruction shown to user

func (*UI) Debug

func (u *UI) Debug(message string)

Debug Print a debug

func (*UI) Error

func (u *UI) Error(message string)

Error print an error Msg

func (*UI) Fatal

func (u *UI) Fatal(message string)

Fatal Print a message describing a fatal error

func (*UI) Msg

func (u *UI) Msg(message string)

Msg will print give data with give color and format

func (*UI) Output

func (u *UI) Output(config Config, data interface{})

func (*UI) Warn

func (u *UI) Warn(message string)

Warn Print a warning message

type YamlPresenter

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

func NewYamlPresenter

func NewYamlPresenter(separator, attr, runList string) *YamlPresenter

func (*YamlPresenter) DisplayCookBook

func (yp *YamlPresenter) DisplayCookBook(data interface{}) interface{}

DisplayCookBook will display cookbook in given format

func (*YamlPresenter) Format

func (yp *YamlPresenter) Format(data interface{}) string

Format will format in pretty print

func (*YamlPresenter) FormatSubSet

func (yp *YamlPresenter) FormatSubSet(data string) string

FormatSubSet will separate data on give input

func (*YamlPresenter) ListDisplay

func (yp *YamlPresenter) ListDisplay(config Config, data interface{}) interface{}

ListDisplay list display sort tje list and print result

func (*YamlPresenter) NameOrID

func (yp *YamlPresenter) NameOrID(data map[string]interface{}) interface{}

NameOrID will print name or id

func (*YamlPresenter) NestedValue

func (yp *YamlPresenter) NestedValue(data interface{}) interface{}

NestedValue will get all nested value matching to attr

func (*YamlPresenter) Summarize

func (yp *YamlPresenter) Summarize(data string) string

Summarize Summarize given input

Jump to

Keyboard shortcuts

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