diff options
Diffstat (limited to 'oni-php/scripts/find-php-class')
| -rwxr-xr-x | oni-php/scripts/find-php-class | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/oni-php/scripts/find-php-class b/oni-php/scripts/find-php-class new file mode 100755 index 0000000..65f43fc --- /dev/null +++ b/oni-php/scripts/find-php-class @@ -0,0 +1,19 @@ +#!/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))))) |
