1
0
Fork 0
emacs-config/oni-php/scripts/find-php-class

20 lines
666 B
Text
Raw Normal View History

#!/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)))))