Hi,

I am relatively new to clojure and while using the contrib.command-
line, I found there is a place for a small improvement, at least for
my usecase :-)

I use the with-command-line macro and then check eg. that the
remaining parameters, that are not caught amount to the right number
(eg. I want to have a commandline, where there are options and at most
two additional arguments). In case the check fails, it would be
beautiful to print the help message that gets printed, when -h or --
help is provided. Currently I cannot call the "print-help" function
because I do not have access to the necessary parameters.

If the with-command-line macro would be slightly changed to add a
binding to a "print-usage" function:
like
(let [~(symbol "print-usage") #(print-help ~desc cmdmap#) ]

then it be possible to do something like this:

(with-command-line  ["-s" "1" "2"]  "Usage: testfile [Options]
<configuration file> <outputfile>"
    [[synonyms? s? "Use Synonyms"][normalizer? n? "Use Normalizer"]
files]
    (if (= 2 (count files))
      (println (files 0))
      ;;else
      (print-usage)))

Is that a good idea?


-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to