| 2782 | /* ── Files ─────────────────────────────────────────────────────────── */ |
| 2783 | |
| 2784 | static bool sh_mentions_deploy_tool(const char *src, size_t n) { |
| 2785 | static const char *const tools[] = {"kubectl", "helm", "kustomize", "docker", |
| 2786 | "podman", "buildah", "nerdctl"}; |
| 2787 | for (size_t i = 0; i < n; i++) { |
| 2788 | char c = src[i] | ' '; |
| 2789 | if (!strchr("khdpbn", c)) { |
| 2790 | continue; |
| 2791 | } |
| 2792 | for (size_t t = 0; t < sizeof(tools) / sizeof(tools[0]); t++) { |
| 2793 | size_t tl = strlen(tools[t]); |
| 2794 | size_t j = 0; |
| 2795 | while (j < tl && i + j < n && (src[i + j] | ' ') == tools[t][j]) { |
| 2796 | j++; |
| 2797 | } |
| 2798 | if (j == tl) { |
| 2799 | return true; |
| 2800 | } |
| 2801 | } |
| 2802 | } |
| 2803 | return false; |
| 2804 | } |
| 2805 | |
| 2806 | static char *sh_read(const char *path, size_t *len) { |
| 2807 | FILE *f = cbm_fopen(path, "rb"); |