Compare commits
2 Commits
master
...
show-depen
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ccafe077b4 | ||
![]() |
3a7517ae81 |
|
@ -120,6 +120,28 @@
|
||||||
(pretty-write direct-requirers))]))
|
(pretty-write direct-requirers))]))
|
||||||
(newline))))
|
(newline))))
|
||||||
|
|
||||||
|
(define (dependencies->graphviz #:exclude [exclude null]
|
||||||
|
#:exclude-deps [exclude-deps null]
|
||||||
|
. module-paths)
|
||||||
|
(define (show m)
|
||||||
|
(parameterize ([pretty-print-columns 'infinity])
|
||||||
|
(write (pretty-format m))))
|
||||||
|
|
||||||
|
(printf "digraph deps {\n")
|
||||||
|
(for ([dep (in-list (apply get-dependencies
|
||||||
|
#:exclude exclude
|
||||||
|
#:exclude-deps exclude-deps
|
||||||
|
module-paths))])
|
||||||
|
(let ([mod (car dep)]
|
||||||
|
[direct-requirers (cadr dep)])
|
||||||
|
(for ([direct-requirer (in-list direct-requirers)])
|
||||||
|
(printf " ")
|
||||||
|
(show direct-requirer)
|
||||||
|
(printf " -> ")
|
||||||
|
(show mod)
|
||||||
|
(printf "\n"))))
|
||||||
|
(printf "}\n"))
|
||||||
|
|
||||||
;; ====
|
;; ====
|
||||||
|
|
||||||
(define (main . argv)
|
(define (main . argv)
|
||||||
|
@ -128,6 +150,7 @@
|
||||||
(define multi-line-context? #f)
|
(define multi-line-context? #f)
|
||||||
(define excludes null)
|
(define excludes null)
|
||||||
(define exclude-deps null)
|
(define exclude-deps null)
|
||||||
|
(define graphviz? #f)
|
||||||
(command-line
|
(command-line
|
||||||
#:program (short-program+command-name)
|
#:program (short-program+command-name)
|
||||||
#:argv argv
|
#:argv argv
|
||||||
|
@ -141,12 +164,16 @@
|
||||||
(set! mode 'file)]
|
(set! mode 'file)]
|
||||||
[("-m" "--module-path") "Interpret arguments as module-paths"
|
[("-m" "--module-path") "Interpret arguments as module-paths"
|
||||||
(set! mode 'module-path)]
|
(set! mode 'module-path)]
|
||||||
|
[("-b") "Same as --exclude racket/base"
|
||||||
|
(set! excludes (cons 'racket/base excludes))]
|
||||||
|
[("-g" "--graphviz") "Output in graphviz (dot) format (implies --context)"
|
||||||
|
(set! graphviz? #t)
|
||||||
|
(set! context? #t)]
|
||||||
|
#:multi
|
||||||
[("-x" "--exclude") mod "Exclude <mod> and its dependencies"
|
[("-x" "--exclude") mod "Exclude <mod> and its dependencies"
|
||||||
(set! excludes (cons mod excludes))]
|
(set! excludes (cons mod excludes))]
|
||||||
[("-X" "--exclude-deps") mod "Exclude the dependencies of <mod> (but not <mod> itself)"
|
[("-X" "--exclude-deps") mod "Exclude the dependencies of <mod> (but not <mod> itself)"
|
||||||
(set! exclude-deps (cons mod exclude-deps))]
|
(set! exclude-deps (cons mod exclude-deps))]
|
||||||
[("-b") "Same as --exclude racket/base"
|
|
||||||
(set! excludes (cons 'racket/base excludes))]
|
|
||||||
#:args module-path
|
#:args module-path
|
||||||
(let ()
|
(let ()
|
||||||
(define (->modpath x)
|
(define (->modpath x)
|
||||||
|
@ -160,12 +187,17 @@
|
||||||
((module-path)
|
((module-path)
|
||||||
(read (open-input-string x))))]
|
(read (open-input-string x))))]
|
||||||
[else x]))
|
[else x]))
|
||||||
(apply show-dependencies
|
(if graphviz?
|
||||||
#:exclude (map ->modpath excludes)
|
(apply dependencies->graphviz
|
||||||
#:exclude-deps (map ->modpath exclude-deps)
|
#:exclude (map ->modpath excludes)
|
||||||
#:show-context? context?
|
#:exclude-deps (map ->modpath exclude-deps)
|
||||||
#:multi-line-context? multi-line-context?
|
(map ->modpath module-path))
|
||||||
(map ->modpath module-path)))))
|
(apply show-dependencies
|
||||||
|
#:exclude (map ->modpath excludes)
|
||||||
|
#:exclude-deps (map ->modpath exclude-deps)
|
||||||
|
#:show-context? context?
|
||||||
|
#:multi-line-context? multi-line-context?
|
||||||
|
(map ->modpath module-path))))))
|
||||||
|
|
||||||
(module* main #f
|
(module* main #f
|
||||||
(apply main (vector->list (current-command-line-arguments))))
|
(apply main (vector->list (current-command-line-arguments))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user