MCPcopy Create free account
hub / github.com/cli/cli / validateScope

Function validateScope

pkg/cmd/config/set/set.go:105–120  ·  view source on GitHub ↗
(key, hostname string)

Source from the content-addressed store, hash-verified

103}
104
105func validateScope(key, hostname string) error {
106 for _, configKey := range config.Options {
107 if key == configKey.Key {
108 switch {
109 case configKey.Scope == config.ConfigScopeHostOnly && hostname == "":
110 return fmt.Errorf("--host required when setting %s", key)
111 case configKey.Scope == config.ConfigScopeGlobalOnly && hostname != "":
112 return fmt.Errorf("--host cannot be used when setting %s", key)
113 default:
114 return nil
115 }
116 }
117 }
118
119 return nil
120}
121
122type InvalidValueError struct {
123 ValidValues []string

Callers 2

setRunFunction · 0.85
Test_validateScopeFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by 1

Test_validateScopeFunction · 0.68