MCPcopy
hub / github.com/cli/cli / toConfigEntry

Function toConfigEntry

internal/config/config.go:87–91  ·  view source on GitHub ↗

toConfigEntry is a helper function to convert a string value to a ConfigEntry with a given source. It's a bit of FP style but it allows us to map an Option[string] to Option[gh.ConfigEntry] without unwrapping the it and rewrapping it.

(source gh.ConfigSource)

Source from the content-addressed store, hash-verified

85// It's a bit of FP style but it allows us to map an Option[string] to Option[gh.ConfigEntry] without
86// unwrapping the it and rewrapping it.
87func toConfigEntry(source gh.ConfigSource) func(val string) gh.ConfigEntry {
88 return func(val string) gh.ConfigEntry {
89 return gh.ConfigEntry{Value: val, Source: source}
90 }
91}
92
93func (c *cfg) Set(hostname, key, value string) {
94 if hostname == "" {

Callers 1

GetOrDefaultMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected