MCPcopy Index your code
hub / github.com/coder/coder / translateSource

Function translateSource

cli/root.go:1825–1836  ·  view source on GitHub ↗

translateSource provides the name of the source of the option, depending on the supplied target ValueSource.

(target serpent.ValueSource, opt serpent.Option)

Source from the content-addressed store, hash-verified

1823// translateSource provides the name of the source of the option, depending on the
1824// supplied target ValueSource.
1825func translateSource(target serpent.ValueSource, opt serpent.Option) string {
1826 switch target {
1827 case serpent.ValueSourceFlag:
1828 return fmt.Sprintf("`--%s`", opt.Flag)
1829 case serpent.ValueSourceEnv:
1830 return fmt.Sprintf("`%s`", opt.Env)
1831 case serpent.ValueSourceYAML:
1832 return fmt.Sprintf("`%s`", fullYamlName(opt))
1833 default:
1834 return opt.Name
1835 }
1836}
1837
1838func fullYamlName(opt serpent.Option) string {
1839 var full strings.Builder

Callers 1

PrintDeprecatedOptionsFunction · 0.85

Calls 1

fullYamlNameFunction · 0.85

Tested by

no test coverage detected