#!/usr/bin/env -S scsh -e main -o srfi-1 -s !# (define (main args) (let* ((class-name (cadr args)) (file-names (run/strings (find "." -type f -name ,(string-append class-name ".php") -exec grep "^namespace" "{}" ";") (> 2 "/dev/null")))) (format #t "~s" (delete-duplicates (map (lambda (n) (string-append (match:substring (regexp-search (rx "namespace " (submatch (+ any)) ";") n) 1) "\\" class-name)) file-names)))))