commands

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

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

View Source
const DiscfgFileName = ".discfg"

DiscfgFileName defines the temporary filename used to hold the current working config name

View Source
const InvalidKeyNameMsg = "Invalid key name"

InvalidKeyNameMsg defines a message for input validation

View Source
const MissingCfgNameMsg = "Missing configuration name"

MissingCfgNameMsg defines a message for input validation

View Source
const MissingKeyNameMsg = "Missing key name"

MissingKeyNameMsg defines a message for input validation when a key name was not passed

View Source
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

View Source
const NotEnoughArgsMsg = "Not enough arguments passed. Run 'discfg help' for usage."

NotEnoughArgsMsg defines a message for input validation

View Source
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 Export

func Export(opts config.Options, args []string)

Export a discfg to file in JSON format

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

Info about the configuration including global version/state and modified time

func Out

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)

func Use

Use sets a discfg configuration to use for all future commands until unset (it is optional, but conveniently saves a CLI argument - kinda like MongoDB's use)

func Which

func Which(opts config.Options) config.ResponseObject

Which shows which discfg configuration is currently active for use

Types

This section is empty.

Jump to

Keyboard shortcuts

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