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

Function sh_chart

src/pipeline/pass_shell.c:1593–1624  ·  view source on GitHub ↗

The chart a helm word names: a chart dir, else an external chart. */

Source from the content-addressed store, hash-verified

1591
1592/* The chart a helm word names: a chart dir, else an external chart. */
1593static void sh_chart(sh_t *s, TSNode cmd, const char *v) {
1594 if (!v) {
1595 return;
1596 }
1597 if (sh_starts(v, "oci://")) {
1598 const char *ext = sh_value_basename(s->a, v + strlen("oci://"));
1599 if (ext && ext[0] && !strchr(ext, ':')) {
1600 sh_hit(s, cmd, "helm", NULL, ext, true);
1601 }
1602 return;
1603 }
1604 sh_targets_t ts = {0};
1605 sh_targets_of(s, v, sh_t_chart, NULL, &ts);
1606 if (ts.count > 0) {
1607 sh_hit_all(s, cmd, "helm", &ts, true);
1608 cbm_free(CBM_MEM_CLASS_OTHER, ts.items);
1609 return;
1610 }
1611 cbm_free(CBM_MEM_CLASS_OTHER, ts.items);
1612 /* repo/name: one slash, a plain name on each side */
1613 const char *slash = strchr(v, '/');
1614 if (!slash || strchr(slash + SKIP_ONE, '/') || v[0] == '.' || slash == v || !slash[SKIP_ONE]) {
1615 return;
1616 }
1617 for (const char *p = v; *p; p++) {
1618 if (!(*p == '/' || *p == '.' || *p == '_' || *p == '-' || (*p >= '0' && *p <= '9') ||
1619 (*p >= 'a' && *p <= 'z') || (*p >= 'A' && *p <= 'Z'))) {
1620 return;
1621 }
1622 }
1623 sh_hit(s, cmd, "helm", NULL, slash + SKIP_ONE, true);
1624}
1625
1626/* helm install|upgrade [NAME] CHART; helm template [NAME] CHART as a source. */
1627static void sh_helm(sh_t *s, TSNode cmd, const sh_argv_t *a, int prog, sh_src_t *out) {

Callers 2

sh_helmFunction · 0.85
sh_deploy_srcFunction · 0.85

Calls 6

sh_startsFunction · 0.85
sh_value_basenameFunction · 0.85
sh_hitFunction · 0.85
sh_targets_ofFunction · 0.85
sh_hit_allFunction · 0.85
cbm_freeFunction · 0.85

Tested by

no test coverage detected