Changeset 159


Ignore:
Timestamp:
03/05/08 05:39:54 (17 years ago)
Author:
Magnus Henoch
Message:

Move INVALID-ARGUMENTS condition to getopt.lisp, and use it.

Location:
cl-darcs/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified cl-darcs/trunk/cmdline.lisp

    r158 r159  
    2727    "Turn a command symbol into a function symbol."
    2828    (intern (format nil "CMD-~A" command) :darcs)))
    29 
    30 (define-condition invalid-arguments (simple-error)
    31   ())
    3229
    3330(defun handle-command-line (argv)
  • TabularUnified cl-darcs/trunk/getopt.lisp

    r158 r159  
    1616
    1717(in-package :darcs)
     18
     19(define-condition invalid-arguments (simple-error)
     20  ())
    1821
    1922;; The option struct describes a command line option.
     
    5457                       (if (option-arg opt)
    5558                           (if (or no-argument (null args))
    56                                (error "Option ~A requires an argument." arg)
     59                               (error 'invalid-arguments
     60                                      :format-control "Option ~A requires an argument."
     61                                      :format-arguments (list arg))
    5762                               (pop args))
    5863                           t))
     
    8186                   (option (find long-option options :key #'option-long :test #'string=)))
    8287              (unless option
    83                 (error "Unknown long option ~S (none of ~{~S ~})." arg (mapcar #'option-long options)))
     88                (error 'invalid-arguments
     89                       :format-control "Unknown long option ~S (none of ~{~S ~})."
     90                       :format-arguments (list arg (mapcar #'option-long options))))
    8491              (maybe-get-argument arg option)))
    8592
     
    94101                          (option (find letter options :key #'option-short)))
    95102                     (unless option
    96                        (error "Unknown option ~A." letter))
     103                       (error 'invalid-arguments
     104                              :format-control "Unknown option ~A."
     105                              :format-arguments (list letter)))
    97106                     ;; Only the last short option can have an argument.
    98107                     (maybe-get-argument letter option
Note: See TracChangeset for help on using the changeset viewer.