Created
June 19, 2017 18:23
-
-
Save dieggsy/bc589413f753ffc8af299c028add55f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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)) ;; 'e or 'elephant both work |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment