source: project/nest-tool/trunk/chicken-nest-tool.scm @ 5797

Last change on this file since 5797 was 5797, checked in by Mario Domenech Goulart, 13 years ago

Experimental dependencies graph generation.

File size: 2.4 KB
Line 
1(use tool nest-tool (srfi 13))
2
3(define-flag '(#\d "omit-date") "omit release date when showing search results" omit-date)
4(define-flag '(#\D "omit-deps") "omit dependencies when showing search results" omit-dependencies)
5(define-flag '(#\f "omit-file") "omit egg filename when showing search results" omit-file)
6
7(define dep-graph-dir ".")
8(define dep-graph-format 'png)
9
10(define (show egg date file deps)
11  (let ((egg (if egg (symbol->string egg) ""))
12        (deps (string-intersperse (map symbol->string (or deps '())) ",")))
13    (print (string-append
14            (string-pad-right egg 24)
15            (if date (string-pad-right date 15) "")
16            (if file (string-pad-right file 30) "")
17            deps))))
18
19(define (search proc)
20  (lambda (opt name arg seeds)
21    (for-each (lambda (egg)
22                (show (nest-tool:egg-name egg)
23                      (and (not omit-date) (nest-tool:egg-date egg))
24                      (and (not omit-file) (nest-tool:egg-file egg))
25                      (and (not omit-dependencies) (nest-tool:egg-dependencies egg))))
26              (proc arg))
27    (exit 0)))
28 
29(define-option '(#\s "search")
30  "search eggs names"
31  (search nest-tool:search-names))
32
33(define-option '(#\S "search-deps")
34  "search eggs dependencies"
35  (search nest-tool:search-dependencies))
36
37(define-option '(#\R "repository")
38  "specify a repository file (HTTP URLs are also accepted)"
39  (lambda (opt name arg seeds)
40    (nest-tool:repository arg)))
41
42(define-option '(#\G "dep-graph-dir")
43  "directory where to save dependencies graphs files (default = .)"
44  (lambda (opt name arg seeds)
45    (set! dep-graph-dir arg)))
46
47(define-option '(#\F "dep-graph-format")
48  "format of output graphs graphic files (default = png)"
49  (lambda (opt name arg seeds)
50    (set! dep-graph-format arg)))
51
52(define-option '(#\g "generate-dep-graph")
53  "generate dependencies graphs. Its argument is a comma-separated list of eggs or nothing, which indicates that all the dependencies graphs should be generated"
54  (lambda (opt name arg seeds)
55    (let ((eggs (if (string? arg) (string-split arg ",") #f)))
56      (nest-tool:all-dep-graphs->graphic eggnames: eggs
57                                         output-dir: dep-graph-dir
58                                         format: dep-graph-format))
59    (exit 0)))
60
61(tool-name "chicken-nest-tool")
62(tool-help "Provides operations on CHICKEN extensions repository listings")
63(tool-main (command-line-arguments))
Note: See TracBrowser for help on using the repository browser.