utils

package
v0.0.0-...-f7ec575 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsString

func ContainsString(str string, list []string) bool

Check if a list of strings contains a string

func GetBoolFlag

func GetBoolFlag(cmd *cobra.Command, name string) bool

Get a flag of type boolean from a cobra command

func GetStringFlag

func GetStringFlag(cmd *cobra.Command, name string) string

Get a flag of type string from a cobra command

func MapKeys

func MapKeys(m map[string]string) []string

Get a list of all the keys in map

func ReplaceAllMapped

func ReplaceAllMapped(original string, toReplace map[string]string) string

Replace all keys in the original string with the given values of the map

func WriteFileSafely

func WriteFileSafely(path string, content []byte, relative bool, output bool)

Write to a file safely. Checks if a file already exists or a folder and confirms with the user if they want to overide them. If the user doesn't want to override then the program exits with a 0 exit code. If the path is not relative the current working directory will be added before the path

Types

This section is empty.

Jump to

Keyboard shortcuts

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