Documentation
¶
Index ¶
- Variables
- func OutputLoudEditAttrsResult[K CAttrKey](io IO, modifiedVals map[K]interface{}, noChangeVals map[K]interface{}, ...)
- func SortedAttrMapKeys[K CAttrKey, V any](m map[K]V, order []K) []K
- type AttrKey
- type CAttrKey
- type IO
- func (io IO) CountOf(count int, word string, suffixes ...string) string
- func (io IO) OnOrOff(on bool) string
- func (io IO) OxfordCommaJoin(items []string) string
- func (io IO) PrintErrf(format string, args ...interface{})
- func (io IO) PrintErrln(args ...interface{})
- func (io IO) PrintLoudErrf(format string, args ...interface{})
- func (io IO) PrintLoudErrln(args ...interface{})
- func (io IO) PrintLoudf(format string, args ...interface{})
- func (io IO) PrintLoudln(args ...interface{})
- func (io IO) Printf(format string, args ...interface{})
- func (io IO) Println(args ...interface{})
Constants ¶
This section is empty.
Variables ¶
var ( // If HTTPClient is set, it will be used for all requests made by the // commands that go through morc.Send. Otherwise, the default client will be // used. Generally, this is useful for testing; if it starts getting used // for other things, we may need a way of specifying via CLI args instead. HTTPClient *http.Client = nil )
Functions ¶
func OutputLoudEditAttrsResult ¶ added in v0.3.0
func OutputLoudEditAttrsResult[K CAttrKey](io IO, modifiedVals map[K]interface{}, noChangeVals map[K]interface{}, ordering []K)
OutputEditAttrsResult prints out the results of an edit operation on a set of attributes. It will print out the attributes that were modified and the attributes that were not changed.
All output is considered 'loud' and will not be printed if the IO is in quiet mode.
Edits that resulted in a mutation will be printed to the output stream and edits that did not result in a mutation will be printed to the error stream.
func SortedAttrMapKeys ¶ added in v0.3.0
extracts map keys in order of some strict ordering slice
Types ¶
type AttrKey ¶ added in v0.3.0
AttrKey is an identifier for an attribute of some resource, such as the config keys of a project or a the properties of a request template. It is used for providing standardized output and sorting using OutputLoudEditAttrsResult and SortedAttrMapKeys.
type CAttrKey ¶ added in v0.3.0
type CAttrKey interface {
comparable
AttrKey
}
CAttrKey is an AttrKey that also implements comparable.
type IO ¶
type IO struct {
In io.Reader
Out io.Writer
Err io.Writer
// Quiet is set to true if the command should not print anything to the
// output stream for PrintLoud functions. Other Print functions will still
// print to their repspective streams (out or err).
Quiet bool
}
IO holds the input and output streams for a command, including a settable error, output, and input stream. If Out or Err are not set, the std streams will be used when calling Println, Printf, or their error variants.
func (IO) CountOf ¶
Count returns a string that automatically pluralizes the given word based on whether it is 0 or 1.
If suffixes is not set, it is assumed that the plural is formed by taking word and adding "s". If suffixes is set, the first element is used for the plural form and the second is used for the singular form.
func (IO) OxfordCommaJoin ¶ added in v0.3.0
func (IO) PrintErrln ¶
func (io IO) PrintErrln(args ...interface{})
func (IO) PrintLoudErrf ¶ added in v0.3.0
func (IO) PrintLoudErrln ¶ added in v0.3.0
func (io IO) PrintLoudErrln(args ...interface{})
func (IO) PrintLoudf ¶ added in v0.3.0
func (IO) PrintLoudln ¶ added in v0.3.0
func (io IO) PrintLoudln(args ...interface{})