Rough cli-max API sketch pasted by DerGuteMoritz on Fri Feb 24 14:57:46 2012

(use cli-max)

(define-arguments
  (v verbose)
  (i input-file FILE-NAME required: #t)
  (f filter (* EXPRESSION) as: input-filter)
  (l limit NUMBER convert: to-number default: 10))

;; defines the following variables in the current scope:

;; verbose?     ; a boolean since no third argument was given
;; input-file   ; a string
;; input-filter ; a list of zero or more strings
;; limit        ; a number, 10 if not given

(unless (null? (command-line-errors))
  (for-each
   (lambda (error)
     (fprintf (current-error-port) "~A~%"))
   (command-line-errors))

  (newline)
  (print (command-usage))
  (exit 1))



(define-sub-command commit
  (m message required: #t)
  files-to-commit (+ FILES))

;; global arguments defined above go before a sub command
;; sub command specific arguments follow
;; 
;; program -v commit -m foo bar baz

;; verbose?        ; #t
;; (sub-command)   ; commit
;; message         ; "foo"
;; files-to-commit ; ("bar" "baz")

new cli-max define-arguments API sketch added by DerGuteMoritz on Sat Feb 25 21:04:37 2012

(use cli-max)

(define-arguments
  (verbose?     short: #\v long: 'verbose)
  (input-file   short: #\i value: 'FILE-NAME  required: #t)
  (input-filter long: 'filter value: '(* EXPRESSION))
  (limit        short: #\l value: 'NUMBER convert: to-number default: 10))

;; defines the following variables:

;; verbose?      -v, --verbose                 a boolean since no `value' option was given
;; input-file    -i, --input-file FILE-NAME    a string
;; input-filter  --filter FILTER               a list of zero or more strings, i.e. an optional
;;                                             argument which may be given multiple times
;; limit         -l, --limit NUMBER            a number, 10 if not given