util

package
v1.13.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesFromPathOrContent

func BytesFromPathOrContent(pathOrContent string) ([]byte, error)

func Confirm

func Confirm(msg string, in In, out io.Writer) (bool, error)

func ConfirmContinue

func ConfirmContinue(target string, in In, out io.Writer, ids ...string) (bool, error)

func FileOrStdin

func FileOrStdin(path string) (file *os.File, deferFunc func(), err error)

FileOrStdin ファイルパス、または標準入力をオープンする

pathに空文字または"-"を指定した場合に標準入力が利用される

func FirstNonEmptyString

func FirstNonEmptyString(values ...string) string

func FlagCompletionFunc

func FlagCompletionFunc(options ...string) func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective)

func FlattenErrors

func FlattenErrors(errors []error) error

func FlattenErrorsWithPrefix

func FlattenErrorsWithPrefix(errors []error, pref string) error

func HasTags

func HasTags(target interface{}, tags []string) bool

func IsEmpty

func IsEmpty(object interface{}) bool

IsEmpty is copied from github.com/stretchr/testify/assert/assetions.go

func MarshalJSONFromPathOrContent

func MarshalJSONFromPathOrContent(pathOrContent string, destination interface{}) error

func MonitorCondition

func MonitorCondition(start, end string) (*iaas.MonitorCondition, error)

func ParseDateTimeString

func ParseDateTimeString(strDateTime string) time.Time

func RemoveStringsFromSlice

func RemoveStringsFromSlice(elements []string, remove []string) []string

func StringFromPathOrContent

func StringFromPathOrContent(pathOrContent string) (string, error)

func StringIDs

func StringIDs(ids []types.ID) []string

StringIDs iaas.IDスライスを文字列のスライスに変換する

func UniqIDs

func UniqIDs(elements []types.ID) []types.ID

func UniqStrings

func UniqStrings(elements []string) []string

func ValidIndex

func ValidIndex(index, length int) error

ValidIndex インデックスが有効範囲内にあるか

TODO v0では1開始だったが、v1では0開始とする(GH-552)

Types

type In

type In interface {
	Stat() (os.FileInfo, error)
	io.Reader
}

Jump to

Keyboard shortcuts

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