The args egg provides getopt-like functionality:

(require-extension args)

(define opt_v #f)
                 
(define opts
  `(
    ,(args:make-option (v)       #:none               "set verbose mode"
                       (set! opt_v #t))
    ,(args:make-option (h help)  #:none               "Print help"
                       (usage))))


;; Use args:usage to generate a formatted list of options (from OPTS),
;; suitable for embedding into help text.
(define (usage)
  (print "Usage: " (car (argv)) " [options...] commands ")
  (newline)
  (print "The following options are recognized: ")
  (newline)
  (print (parameterize ((args:indent 5)) (args:usage opts)))
  (exit 1))


;; Process arguments and collate options and arguments into OPTIONS
;; alist, and operands (filenames) into OPERANDS.  You can handle
;; options as they are processed, or afterwards.

(set!-values (options operands)  
   (args:parse (command-line-arguments) opts))


William Xu <[EMAIL PROTECTED]> writes:

> Hi, 
>
> Does chicken have some egg for wrapping getopt, getopt_long? 

-- 
"Their eyes met, and his heart soared, like the price of gas before a
 long weekend." --Cornered, by Mike Baldwin


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to