guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.2-21-g4f0ea6


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.2-21-g4f0ea6e
Date: Sat, 23 Jul 2011 16:50:29 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=4f0ea6e3cef32d54c1a276945b8885433a137b7c

The branch, stable-2.0 has been updated
       via  4f0ea6e3cef32d54c1a276945b8885433a137b7c (commit)
      from  f4a76a315ad8f1f6f4dbdfbd2f030c6b299cb5a4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4f0ea6e3cef32d54c1a276945b8885433a137b7c
Author: Andy Wingo <address@hidden>
Date:   Sat Jul 23 18:50:22 2011 +0200

    add support for guild help FOO
    
    * module/scripts/help.scm (main): Add support for guild help FOO.

-----------------------------------------------------------------------

Summary of changes:
 module/scripts/help.scm |   70 +++++++++++++++++++++++++++++++++++-----------
 1 files changed, 53 insertions(+), 17 deletions(-)

diff --git a/module/scripts/help.scm b/module/scripts/help.scm
index 9bb6ace..665ba9f 100644
--- a/module/scripts/help.scm
+++ b/module/scripts/help.scm
@@ -27,6 +27,7 @@
 
 (define-module (scripts help)
   #:use-module (ice-9 format)
+  #:use-module (ice-9 documentation)
   #:use-module ((srfi srfi-1) #:select (fold append-map)))
 
 (define %summary "Show a brief help message.")
@@ -80,7 +81,7 @@
                   %load-path)
       string<?))))
 
-(define (main . args)
+(define (list-commands all?)
   (display "\
 Usage: guild COMMAND [ARGS]
 
@@ -91,19 +92,54 @@ Usage: guild COMMAND [ARGS]
 Commands:
 ")
 
-  (let ((all? (or (equal? args '("--all"))
-                  (equal? args '("-a")))))
-    (for-each
-     (lambda (name)
-       (let* ((modname `(scripts ,(string->symbol name)))
-              (mod (resolve-module modname #:ensure #f))
-              (summary (and mod (and=> (module-variable mod '%summary)
-                                       variable-ref))))
-         (if (and mod
-                  (or all?
-                      (let ((v (module-variable mod '%include-in-guild-list)))
-                        (if v (variable-ref v) #t))))
-             (if summary
-                 (format #t "  ~A ~23t~a\n" name summary)
-                 (format #t "  ~A\n" name)))))
-     (find-submodules '(scripts)))))
+  (for-each
+   (lambda (name)
+     (let* ((modname `(scripts ,(string->symbol name)))
+            (mod (resolve-module modname #:ensure #f))
+            (summary (and mod (and=> (module-variable mod '%summary)
+                                     variable-ref))))
+       (if (and mod
+                (or all?
+                    (let ((v (module-variable mod '%include-in-guild-list)))
+                      (if v (variable-ref v) #t))))
+           (if summary
+               (format #t "  ~A ~23t~a\n" name summary)
+               (format #t "  ~A\n" name)))))
+   (find-submodules '(scripts)))
+  (display "
+For help on a specific command, try \"guild help COMMAND\".
+"))
+
+(define (module-commentary mod)
+  (file-commentary
+   (%search-load-path (module-filename mod))))
+
+(define (main . args)
+  (cond
+   ((null? args)
+    (list-commands #f))
+   ((or (equal? args '("--all")) (equal? args '("-a")))
+    (list-commands #t))
+   ((not (string-prefix? "-" (car args)))
+    ;; help for particular command
+    (let* ((name (car args))
+           (mod (resolve-module `(scripts ,(string->symbol name))
+                                #:ensure #f)))
+      (if mod
+          (let ((commentary (module-commentary mod)))
+            (if commentary
+                (display commentary)
+                (format #t "No documentation found for command \"~a\".\n"
+                        name)))
+          (begin
+            (format #t "No command named \"~a\".\n" name)
+            (exit 1)))))
+   (else
+    (display "Usage: guild help
+       guild help --all
+       guild help COMMAND
+
+Show a help on guild commands.  With --all, show arcane incantations as
+well.  With COMMAND, show more detailed help for a particular command.
+")
+    (exit 1))))


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]