Documentation ¶
Overview ¶
Package commands contains functions to work with a discfg configuration from a high level.
Package commands utilities and response structs, constants, etc.
Index ¶
- Constants
- func CreateCfg(opts config.Options, settings map[string]interface{}) config.ResponseObject
- func DeleteCfg(opts config.Options) config.ResponseObject
- func DeleteKey(opts config.Options) config.ResponseObject
- func Export(opts config.Options, args []string)
- func FormatJSONValue(resp config.ResponseObject) config.ResponseObject
- func GetDiscfgNameFromFile() string
- func GetKey(opts config.Options) config.ResponseObject
- func Info(opts config.Options) config.ResponseObject
- func Out(opts config.Options, resp config.ResponseObject) config.ResponseObject
- func SetKey(opts config.Options) config.ResponseObject
- func UpdateCfg(opts config.Options, settings map[string]interface{}) config.ResponseObject
- func Use(opts config.Options) config.ResponseObject
- func Which(opts config.Options) config.ResponseObject
Constants ¶
const DiscfgFileName = ".discfg"
DiscfgFileName defines the temporary filename used to hold the current working config name
const InvalidKeyNameMsg = "Invalid key name"
InvalidKeyNameMsg defines a message for input validation
const MissingCfgNameMsg = "Missing configuration name"
MissingCfgNameMsg defines a message for input validation
const MissingKeyNameMsg = "Missing key name"
MissingKeyNameMsg defines a message for input validation when a key name was not passed
const NoCurrentWorkingCfgMsg = "No current working configuration has been set at this path."
NoCurrentWorkingCfgMsg defines a message for an error when a config name can not be found in a .discfg file
const NotEnoughArgsMsg = "Not enough arguments passed. Run 'discfg help' for usage."
NotEnoughArgsMsg defines a message for input validation
const ValueRequiredMsg = "A value is required. Run 'discfg help' for usage."
ValueRequired defines a message for input validation
Variables ¶
This section is empty.
Functions ¶
func CreateCfg ¶
func CreateCfg(opts config.Options, settings map[string]interface{}) config.ResponseObject
CreateCfg creates a new configuration
func DeleteCfg ¶
func DeleteCfg(opts config.Options) config.ResponseObject
DeleteCfg deletes a configuration
func DeleteKey ¶
func DeleteKey(opts config.Options) config.ResponseObject
DeleteKey deletes a key from a configuration
func FormatJSONValue ¶
func FormatJSONValue(resp config.ResponseObject) config.ResponseObject
FormatJSONValue sets the Item Value (an interface{}) as a map[string]interface{} so it can be output as JSON. The stored value could actually be JSON so it tries to Unmarshal. If it can't, it will just be a string value in the response object which will already be JSON (ie. {"value": "the string value"}).
func GetDiscfgNameFromFile ¶
func GetDiscfgNameFromFile() string
GetDiscfgNameFromFile simply returns the name of the set discfg name (TODO: will need to change as .discfg gets more complex).
func GetKey ¶
func GetKey(opts config.Options) config.ResponseObject
GetKey gets a key from a configuration
func Info ¶
func Info(opts config.Options) config.ResponseObject
Info about the configuration including global version/state and modified time
func Out ¶
func Out(opts config.Options, resp config.ResponseObject) config.ResponseObject
Out formats a config.ResponseObject for suitable output
func SetKey ¶
func SetKey(opts config.Options) config.ResponseObject
SetKey sets a key value for a given configuration
func UpdateCfg ¶
func UpdateCfg(opts config.Options, settings map[string]interface{}) config.ResponseObject
UpdateCfg updates a configuration's options/settings (if applicable, depends on the interface)
Types ¶
This section is empty.