MCPcopy Create free account
hub / github.com/diillson/chatcli / pickFirstNonEmpty

Function pickFirstNonEmpty

cli/skill_handler.go:808–815  ·  view source on GitHub ↗

pickFirstNonEmpty returns the first non-empty string from its arguments, or "" when every argument is empty. Lets row helpers express "remote wins, else local, else fallback" without nested ternaries.

(values ...string)

Source from the content-addressed store, hash-verified

806// or "" when every argument is empty. Lets row helpers express
807// "remote wins, else local, else fallback" without nested ternaries.
808func pickFirstNonEmpty(values ...string) string {
809 for _, v := range values {
810 if v != "" {
811 return v
812 }
813 }
814 return ""
815}
816
817// remote*/local* helpers turn nil-safe field reads into one-line calls so
818// callers don't have to interleave `if remote != nil` everywhere.

Callers 3

TestPickFirstNonEmptyFunction · 0.85
printSkillInfoHeaderMethod · 0.85
printSkillInfoDetailsMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestPickFirstNonEmptyFunction · 0.68