utils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeViperValues

func ChangeViperValues(key string, value interface{}) error

ChangeViperValues - changes the values of the viper configuration and saves it in the config file of inspr, if the file is not created it will return an error.

func ExistingKeys

func ExistingKeys() []string

ExistingKeys - returns to the user all available keys in viper's configs.

func ExistsKey

func ExistsKey(key string) bool

ExistsKey - informs to the user if the key passed exists in the default keys that are saved in the inspr config file

func GetCliClient

func GetCliClient() controller.Interface

GetCliClient returns the default controller client for cli.

func GetCliOutput

func GetCliOutput() io.Writer

GetCliOutput returns the default output for cli.

func GetConfiguredScope

func GetConfiguredScope() string

GetConfiguredScope is responsible for returning config value for scope. Avoids having to constants public.

func GetConfiguredServerIP

func GetConfiguredServerIP() string

GetConfiguredServerIP is responsible for returning config value for serverIp. Avoids having to constants public.

func GetScope

func GetScope() (string, error)

GetScope retreives a path for use as base on insprd request. Takes into consideration viper config and scope flag.

func InitViperConfig

func InitViperConfig()

InitViperConfig - sets defaults values and where is the file in which new values can be read

func ProcessArg

func ProcessArg(arg, scope string) (string, string, error)

ProcessArg is responsible for separating a path into an component name and it's parent's path. < path, name, error >

func ReadViperConfig

func ReadViperConfig(basePath string) error

ReadViperConfig - reads the inspr's viper config, in case it didn't found any, it creates one with the defaults values

func SetClient

func SetClient(url string)

SetClient sets the default server IP of CLI

func SetMockedClient

func SetMockedClient(err error)

SetMockedClient configures singleton's client as a mocked client given a error

func SetOutput

func SetOutput(out io.Writer)

SetOutput sets the default output of CLI

Types

This section is empty.

Jump to

Keyboard shortcuts

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