mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 19:50:24 +02:00
fix guile-tools --help and --version
* meta/guile-tools.in: Fix --help and --version.
This commit is contained in:
parent
76aea207c8
commit
0f6611fb8b
1 changed files with 28 additions and 6 deletions
|
@ -39,7 +39,7 @@ exec guile $GUILE_FLAGS -e '(@@ (guile-tools) main)' -s "$0" "$@"
|
||||||
seed
|
seed
|
||||||
(fold kons (kons (car seq) seed) (cdr seq))))
|
(fold kons (kons (car seq) seed) (cdr seq))))
|
||||||
|
|
||||||
(define (help)
|
(define (display-help)
|
||||||
(display "\
|
(display "\
|
||||||
Usage: guile-tools --version
|
Usage: guile-tools --version
|
||||||
guile-tools --help
|
guile-tools --help
|
||||||
|
@ -49,6 +49,14 @@ If PROGRAM is \"list\" or omitted, display available scripts, otherwise
|
||||||
PROGRAM is run with ARGS.
|
PROGRAM is run with ARGS.
|
||||||
"))
|
"))
|
||||||
|
|
||||||
|
(define (display-version)
|
||||||
|
(format #t "guile-tools (GNU Guile ~A) ~A
|
||||||
|
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||||
|
License LGPLv3+: GNU LGPL version 3 or later <http://gnu.org/licenses/lgpl.html>
|
||||||
|
This is free software: you are free to change and redistribute it.
|
||||||
|
There is NO WARRANTY, to the extent permitted by law.
|
||||||
|
" (version) (effective-version)))
|
||||||
|
|
||||||
(define (directory-files dir)
|
(define (directory-files dir)
|
||||||
(if (and (file-exists? dir) (file-is-directory? dir))
|
(if (and (file-exists? dir) (file-is-directory? dir))
|
||||||
(let ((dir-stream (opendir dir)))
|
(let ((dir-stream (opendir dir)))
|
||||||
|
@ -110,8 +118,22 @@ PROGRAM is run with ARGS.
|
||||||
|
|
||||||
(define (main args)
|
(define (main args)
|
||||||
(setlocale LC_ALL "")
|
(setlocale LC_ALL "")
|
||||||
(if (or (equal? (cdr args) '())
|
(cond
|
||||||
|
((or (equal? (cdr args) '())
|
||||||
(equal? (cdr args) '("list")))
|
(equal? (cdr args) '("list")))
|
||||||
(list-scripts)
|
(list-scripts))
|
||||||
|
((string-prefix? "-" (cadr args))
|
||||||
|
(let ((option (cadr args)))
|
||||||
|
(cond
|
||||||
|
((equal? option "--help")
|
||||||
|
(display-help)
|
||||||
|
(exit 0))
|
||||||
|
((equal? option "--version")
|
||||||
|
(display-version)
|
||||||
|
(exit 0))
|
||||||
|
(else
|
||||||
|
(format (current-error-port) "Unrecognized option: ~an" option)
|
||||||
|
(exit 1)))))
|
||||||
|
(else
|
||||||
(let ((mod (find-script (cadr args))))
|
(let ((mod (find-script (cadr args))))
|
||||||
(exit (apply (module-ref mod 'main) (cddr args))))))
|
(exit (apply (module-ref mod 'main) (cddr args)))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue