With the example on the args eggref 
(http://wiki.call-cc.org/eggref/4/args#examples) slightly modified to this:

----------------------------------------------------------------------------------------------------------------
#!/usr/local/bin/csi -script
(use args)

(define opts
(list (args:make-option (c cookie) #:none "give me cookie"
(print "cookie was tasty"))
(args:make-option (d depth) #:optional "debug level [default: 1]"
(print "depth: arg is " arg))
(args:make-option (e elephant) #:required "flatten the argument"
(print "elephant: arg is " arg))
(args:make-option (f file) (required: "NAME") "parse file NAME")
(args:make-option (v V version) #:none "Display version"
(print "args-example $Revision: 1.3 $")
(exit))
(args:make-option (abc) #:none "Recite the alphabet")
(args:make-option (h help) #:none "Display this text"
(usage))))

(define (usage)
(with-output-to-port (current-error-port)
(lambda ()
(print "Usage: " (car (argv)) " [options...] [files...]")
(newline)
(print (args:usage opts))
(print "Report bugs to zbigniewsz at gmail.")))
(exit 1))

(receive (options operands)
(args:parse (command-line-arguments) opts)
(print options))
----------------------------------------------------------------------------------------------------------------

You can see how the behavior of using required arguments (-e or --elephant) 
differs from using optional arguments (-d or --depth). More specifically, -e 
and --elephant work, parsing their arguments as expected, whereas -d produces 
#f except when the option is passed directly after the flag with no spaces 
(-d10, for example), and --depth always returns #f.

Running Ubuntu 17.04

chicken -version:
(c) 2008-2017, The CHICKEN Team
(c) 2000-2007, Felix L. Winkelmann
Version 4.12.0 (rev 6ea24b6)
linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
compiled 2017-02-19 on yves.more-magic.net (Linux)
_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to