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

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

Adding nest-tool

File size: 1.4 KB
Line 
1(use tool nest-tool (srfi 13))
2
3(define-flag '(#\d "omit-date") "omit release date" omit-date)
4(define-flag '(#\D "omit-deps") "omit dependencies" omit-dependencies)
5(define-flag '(#\f "omit-file") "omit egg filename" omit-file)
6
7(define (show egg date file deps)
8  (let ((egg (if egg (symbol->string egg) ""))
9        (deps (string-intersperse (map symbol->string (or deps '())) ",")))
10    (print (string-append
11            (string-pad-right egg 24)
12            (if date (string-pad-right date 15) "")
13            (if file (string-pad-right file 30) "")
14            deps))))
15
16(define (search proc)
17  (lambda (opt name arg seeds)
18    (for-each (lambda (egg)
19                (show (nest-tool:egg-name egg)
20                      (and (not omit-date) (nest-tool:egg-date egg))
21                      (and (not omit-file) (nest-tool:egg-file egg))
22                      (and (not omit-dependencies) (nest-tool:egg-dependencies egg))))
23              (proc arg))
24    (exit 0)))
25 
26(define-option '(#\s "search") "search eggs names"
27  (search nest-tool:search-names))
28
29(define-option '(#\S "search-deps") "search eggs dependencies"
30  (search nest-tool:search-dependencies))
31
32(define-option '(#\R "repository") "specify a repository file (HTTP URLs are also accepted)"
33  (lambda (opt name arg seeds)
34    (nest-tool:repository arg)))
35 
36(tool-name "chicken-nest-tool")
37(tool-help "Provides operations on CHICKEN extensions repository listings")
38(tool-main (command-line-arguments))
Note: See TracBrowser for help on using the repository browser.