util

package
v1.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2020 License: Apache-2.0 Imports: 12 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 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) (*sacloud.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 sacloud.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