1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- (define-module (scripts display-commentary)
- :use-module (ice-9 documentation)
- :export (display-commentary))
- (define %summary "Display the Commentary section from a file or module.")
- (define (display-commentary-one file)
- (format #t "~A commentary:\n~A" file (file-commentary file)))
- (define (module-name->filename-frag ls)
- (let ((ls (map symbol->string ls)))
- (let loop ((ls (cdr ls)) (acc (car ls)))
- (if (null? ls)
- acc
- (loop (cdr ls) (string-append acc "/" (car ls)))))))
- (define (display-module-commentary module-name)
- (cond ((%search-load-path (module-name->filename-frag module-name))
- => (lambda (file)
- (format #t "module ~A\n" module-name)
- (display-commentary-one file)))))
- (define (display-commentary . refs)
- (for-each (lambda (ref)
- (cond ((string? ref)
- (if (equal? 0 (string-index ref #\())
- (display-module-commentary
- (with-input-from-string ref read))
- (display-commentary-one ref)))
- ((list? ref)
- (display-module-commentary ref))))
- refs))
- (define main display-commentary)
|