Commits

evhan committed fd49ba6

Generate markdown from standard input only, disallow named files

Comments (0)

Files changed (2)

schematic-markdown.1.md

 
 # SYNOPSIS
 
-**schematic-markdown** \[*file* ...]
+**schematic-markdown** \[*option* ...]
 
 # DESCRIPTION
 
-**schematic-markdown** generates Markdown for each of its input files,
-writing to standard output. If no *file* is given, standard input is
-used.
+**schematic-markdown** generates Markdown from source code read from
+standard input, writing to standard output.
 
-Input is assumed to be Scheme source, with line comments prefixed by two
-or three semicolons.
+# OPTIONS
+
+-h, --help
+:   Display a usage summary and exit.
+
+-v, --version
+:   Print version information to standard output and exit.
+
+# CAVEATS
+
+Input is assumed to be Scheme source with line comments prefixed by two
+or three semicolons, and there is currently no way to change this
+behavior.
 
 # SEE ALSO
 

schematic-markdown.scm

    comment-strings
    port))
 
-(define (process-file file)
-  (call-with-input-file file
-   (lambda (port)
-     (process-input comment-strings port))))
-
-(define (main files)
-  (with-exception-handler error-exit
-   (lambda ()
-     (if (pair? files)
-         (for-each process-file files)
-         (process-input comment-strings (current-input-port))))))
-
-;; Parse the command line, invoking `main` with the list of input files.
+;; Parse the command line and process input.
 (for-each
  (lambda (option)
    (case (car option)
      ((-h --help)
       (display "Usage: ")
       (display (car (command-line)))
-      (display " [file ...]")
       (newline)
       (exit))
      ((-v --version)
       (newline)
       (exit))
      ((--)
-      (main (cdr option)))))
+      (with-exception-handler error-exit
+       (lambda ()
+         (if (null? (cdr option))
+             (process-input comment-strings (current-input-port))
+             (error "Unrecognized command line argument" (cadr option))))))))
  (parse-command-line
   '(((-h --help))
     ((-v --version)))))