Hi,

I created the command-line argument parser library for Clojure.
It is a wrapper for argparse4j Java library.
Argparse4j is developed based on Python's argparse module.

I know the tools.cli. This library is a little bit more powerful and
has additional features such as sub-commands and multiple valued
option.

If you are interested in this library, feel free to comment. Any
feedback is welcome.
Here is an user guide: http://argparse4clj.sourceforge.net/usage.html

Best regards,

Tatsuhiro Tsujikawa

Here is a sample code:

(ns demo (:use [net.sourceforge.argparse4clj]))

(def args
 (parse-args
  *command-line-args*
  (new-argument-parser
   {:prog "demo", :description "Process some integers."}
   (add-argument "integers" {:metavar "N", :type Integer, :nargs "+"
                             :help "an integer for the accumulator"})
   (add-argument "--sum" {:dest :accumulate, :action :store-const,
                          :const +, :default max
                          :help "sum the integers (default: find the
max)"}))))
(println (apply (args :accumulate) (args :integers)))

With --help option, it prints help message like this:

usage: demo [-h] [--sum] N [N ...]

Process some integers.

positional arguments:
  N                      an integer for the accumulator

optional arguments:
  -h, --help             show this help message and exit
  --sum                  sum the integers (default: find the max)

-- 
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