utils

package
v0.0.0-...-a8f3bf5 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2018 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecCmd

func ExecCmd(command string, args []string, o io.Writer, e io.Writer) ([]byte, []byte, error)

ExecCmd executes command shell. It redirects output and errors to standard and then stores in a bytes. It returns command's stdout and stderr in bytes and error of command execution

func GetMapKeys

func GetMapKeys(m interface{}) ([]interface{}, error)

GetMapKeys returns a slice of keys.

func GetMapSortedKeys

func GetMapSortedKeys(m interface{}, reverse bool) interface{}

GetMapSortedKeys returns a sorted slice contaning keys of map as interface{}// and need to be casted in the format as you want

This function supports the following type of key: string, int If the given parameter is not a map, it will return nil

func IsElementInArray

func IsElementInArray(elem interface{}, array []interface{}, fn CompareFunc) bool

Check if an element is in an array of elements of the same type func IsElementInArray(elem interface{}, array []interface{}, fn CompareFunc) bool {

func StripAnsi

func StripAnsi(str string) string

StripAnsi removes ANSI escape code from string

Types

type CompareFunc

type CompareFunc func(elem1 interface{}, elem2 interface{}) bool

type void* interface{}

Jump to

Keyboard shortcuts

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