MCPcopy Create free account
hub / github.com/driangle/taskmd / parseIDConfig

Function parseIDConfig

apps/cli/internal/cli/validate.go:268–289  ·  view source on GitHub ↗

parseIDConfig converts raw viper id data into a typed IDConfig. Returns nil if raw is nil or not a map.

(raw any)

Source from the content-addressed store, hash-verified

266// parseIDConfig converts raw viper id data into a typed IDConfig.
267// Returns nil if raw is nil or not a map.
268func parseIDConfig(raw any) *validator.IDConfig {
269 if raw == nil {
270 return nil
271 }
272 m, ok := raw.(map[string]any)
273 if !ok {
274 return nil
275 }
276
277 cfg := &validator.IDConfig{}
278
279 if s, ok := m["strategy"].(string); ok {
280 cfg.Strategy = s
281 }
282 if s, ok := m["prefix"].(string); ok {
283 cfg.Prefix = s
284 }
285 cfg.Length = toInt(m["length"])
286 cfg.Padding = toInt(m["padding"])
287
288 return cfg
289}
290
291// parsePhasesConfig converts raw viper phases data into typed PhaseConfig entries.
292func parsePhasesConfig(raw any) []validator.PhaseConfig {

Callers 7

loadConfigForValidationFunction · 0.85
resolveIDConfigFunction · 0.85
TestParseIDConfig_NilFunction · 0.85

Calls 1

toIntFunction · 0.70

Tested by 5

TestParseIDConfig_NilFunction · 0.68