Compare commits
No commits in common. "show-dependencies-graphviz" and "master" have entirely different histories.
show-depen
...
master
|
@ -120,28 +120,6 @@
|
||||||
(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)
|
||||||
|
@ -150,7 +128,6 @@
|
||||||
(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
|
||||||
|
@ -164,16 +141,12 @@
|
||||||
(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)
|
||||||
|
@ -187,17 +160,12 @@
|
||||||
((module-path)
|
((module-path)
|
||||||
(read (open-input-string x))))]
|
(read (open-input-string x))))]
|
||||||
[else x]))
|
[else x]))
|
||||||
(if graphviz?
|
(apply show-dependencies
|
||||||
(apply dependencies->graphviz
|
#:exclude (map ->modpath excludes)
|
||||||
#:exclude (map ->modpath excludes)
|
#:exclude-deps (map ->modpath exclude-deps)
|
||||||
#:exclude-deps (map ->modpath exclude-deps)
|
#:show-context? context?
|
||||||
(map ->modpath module-path))
|
#:multi-line-context? multi-line-context?
|
||||||
(apply show-dependencies
|
(map ->modpath module-path)))))
|
||||||
#: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