MCPcopy
hub / github.com/mislav/hub / magicValue

Function magicValue

commands/api.go:342–359  ·  view source on GitHub ↗
(value string)

Source from the content-addressed store, hash-verified

340)
341
342func magicValue(value string) interface{} {
343 switch value {
344 case trueVal:
345 return true
346 case falseVal:
347 return false
348 case nilVal:
349 return nil
350 default:
351 if strings.HasPrefix(value, "@") {
352 return string(readFile(value[1:]))
353 } else if i, err := strconv.Atoi(value); err == nil {
354 return i
355 } else {
356 return value
357 }
358 }
359}
360
361func readFile(file string) (content []byte) {
362 var err error

Callers 1

apiCommandFunction · 0.85

Calls 1

readFileFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…