logs-devel
[Top][All Lists]
Advanced

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

[Logs-devel] cl-cli proposal -- defopt


From: Jim Prewett
Subject: [Logs-devel] cl-cli proposal -- defopt
Date: Sun, 25 Jun 2006 09:29:47 -0600 (MDT)

Hello,

I'm thinking a more elegant way to specify a command line option might be 
a macro I'm working on called defopt.  Here is an example usage:

(defopt 
        ;; the name of the flag is "file"
        "file"
        ;; the flag takes a filename parameter and optional position 
        ;; parameter
        (filename &optional position)
        ;; expression (with parameters bound)
        ;; to set up things properly for that flag
        ;; (this is the body of the lambda function)
        (let ((ff 
               (make-instance 
                'org.prewett.LoGS::File-Follower
                :FileName
                filename)))
                ;; if position is specified, start there
                (when position
                (when (not ff) (error "no ff~%"))
                (org.prewett.LoGS::set-file-follower-position
                 ff
                 (read-from-string position)))
                (push ff *file-list*)) 
        ;; a list of (optional) aliases for this flag
        :aliases '("f") 
        ;; the description of this flag, used in the help text
        :description "file to read from")

Does this look somewhat reasonable?

I'm thinking that by specifying an option this way, the user only has to 
specify the argument list once, and in a much more lispy way IMO.

Thanks,
Jim

James E. Prewett                    address@hidden address@hidden 
Systems Team Leader           LoGS: http://www.hpc.unm.edu/~download/LoGS/ 
Designated Security Officer         OpenPGP key: pub 1024D/31816D93    
HPC Systems Engineer III   UNM HPC  505.277.8210





reply via email to

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