Create separate module for listing all rico tools.
This commit is contained in:
parent
866600ac08
commit
89dc7afd02
|
@ -1,6 +1,6 @@
|
||||||
#lang scheme/base
|
#lang scheme/base
|
||||||
(require setup/getinfo
|
(require "command-name.ss"
|
||||||
"command-name.ss")
|
"all-tools.ss")
|
||||||
|
|
||||||
(define cmdline (vector->list (current-command-line-arguments)))
|
(define cmdline (vector->list (current-command-line-arguments)))
|
||||||
|
|
||||||
|
@ -23,41 +23,8 @@
|
||||||
(hash-ref hash s)
|
(hash-ref hash s)
|
||||||
'ambiguous))))))
|
'ambiguous))))))
|
||||||
|
|
||||||
(let* ([dirs (find-relevant-directories '(rico))]
|
(let* ([tools (all-tools)]
|
||||||
[infos (map get-info/full dirs)]
|
[show-all?
|
||||||
[tools (make-hash)])
|
|
||||||
(for-each (lambda (i d)
|
|
||||||
(for-each (lambda (entry)
|
|
||||||
(cond
|
|
||||||
[(and (list? entry)
|
|
||||||
(= (length entry) 4)
|
|
||||||
(string? (car entry))
|
|
||||||
(module-path? (cadr entry))
|
|
||||||
(string? (caddr entry))
|
|
||||||
(or (not (list-ref entry 3))
|
|
||||||
(real? (list-ref entry 3))))
|
|
||||||
(let ([p (hash-ref tools (car entry) #f)])
|
|
||||||
(when p
|
|
||||||
(fprintf
|
|
||||||
(current-error-port)
|
|
||||||
"warning: tool ~s registered twice: ~e and ~e"
|
|
||||||
(car entry)
|
|
||||||
(car p)
|
|
||||||
d)))
|
|
||||||
(hash-set! tools (car entry) entry)]
|
|
||||||
[else
|
|
||||||
(fprintf
|
|
||||||
(current-error-port)
|
|
||||||
"warning: ~s provided bad `rico' spec: ~e"
|
|
||||||
d
|
|
||||||
entry)]))
|
|
||||||
(let ([l (i 'rico (lambda () null))])
|
|
||||||
(if (list? l)
|
|
||||||
l
|
|
||||||
(list l)))))
|
|
||||||
infos
|
|
||||||
dirs)
|
|
||||||
(let ([show-all?
|
|
||||||
(cond
|
(cond
|
||||||
[(null? cmdline) #f]
|
[(null? cmdline) #f]
|
||||||
[(or (equal? (car cmdline) "--help")
|
[(or (equal? (car cmdline) "--help")
|
||||||
|
@ -108,4 +75,4 @@
|
||||||
(printf "\nSee `rico --help' for a complete list of commands."))
|
(printf "\nSee `rico --help' for a complete list of commands."))
|
||||||
(printf "\nSee `rico <command> --help' for help on a command.")
|
(printf "\nSee `rico <command> --help' for help on a command.")
|
||||||
(newline)
|
(newline)
|
||||||
(exit (if show-all? 0 1))))
|
(exit (if show-all? 0 1)))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user