MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / kust_target

Function kust_target

internal/cbm/extract_k8s.c:244–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242} kust_target_t;
243
244static void kust_target(CBMExtractCtx *ctx, TSNode map, kust_target_t *t) {
245 CBMArena *a = ctx->arena;
246 k8s_kids_t pairs = k8s_kids(map);
247 TSNode pair;
248 while (k8s_kid(&pairs, false, &pair)) {
249 if (strcmp(ts_node_type(pair), "block_mapping_pair") != 0) {
250 continue;
251 }
252 const char *key = get_scalar_text(a, ts_node_named_child(pair, 0), ctx->source);
253 TSNode v = unwrap_pair_value(pair);
254 const char *val = key && !ts_node_is_null(v) ? get_scalar_text(a, v, ctx->source) : NULL;
255 if (!val || !val[0]) {
256 continue;
257 }
258 if (strcmp(key, "kind") == 0) {
259 t->kind = val;
260 } else if (strcmp(key, "group") == 0) {
261 t->group = val;
262 } else if (strcmp(key, "version") == 0) {
263 t->version = val;
264 } else if (strcmp(key, "name") == 0) {
265 t->name = val;
266 } else if (strcmp(key, "namespace") == 0) {
267 t->ns = val;
268 } else if (strcmp(key, "labelSelector") == 0) {
269 t->selector = val;
270 } else if (strcmp(key, "annotationSelector") == 0) {
271 t->unsupported = true;
272 }
273 }
274}
275
276// The block mapping a sequence item holds, null when it holds none (a
277// string entry, which emit_kustomize_sequence imports).

Callers 1

emit_kustomize_patchesFunction · 0.85

Calls 4

k8s_kidsFunction · 0.85
k8s_kidFunction · 0.85
get_scalar_textFunction · 0.85
unwrap_pair_valueFunction · 0.85

Tested by

no test coverage detected