id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,difficulty 717,args egg does not call option body for missing args,Jim Ursetto,Jim Ursetto,"User alanh reports that for options with required arguments, the option processor body is not called with ARG #f when the argument is missing. {{{ (use args) (define opts (list (args:make-option (a apple) #:required ""..."" (cond ((not arg) (error ""usage...""))))))) (receive (options operands) (args:parse (command-line-arguments) opts) (print ""-- never should have gotten here on `test.scm -a'"")) }}} This was in fact the intended behavior -- when the arg is missing, the option is simply treated as not present on the command line, so you can handle it like you would any other missing option. For example {{{ (receive (options operands) (args:parse (command-line-arguments) opts) (unless (assq 'apple options) (error ""Missing option -a"")) (print ""-- never should have gotten here on `test.scm -a'"")) }}} The rationale is that if the option is formatted invalidly, the program should just revert to the default value for the option. It's possible to change this behavior, but note that missing optional and required arguments can't be detected unless they're absolutely last on the command-line, as SRFI 37 doesn't distinguish options from arguments (e.g. by using initial dash). So the utility of this change would be very limited.",defect,closed,not urgent at all,,extensions,4.7.x,wontfix,args command-line,,