 
 ;; Print usage information.
 
-(defn usage []
-  (println (str "\nUsage: revdiff object [regexp]\n"))
-  (println "  object : svn URI or name of versioned object in working-copy")
-  (println "  regexp : only show diffs where a changed line matches regexp\n"))
+(defn usage [summary code]
+  (println (str "\nUsage: revdiff [options] object [regexp]\n\n  Options:\n"))
+  (println (str summary "\n"))
+  (println "  object: svn URI or name of versioned object in working-copy")
+  (println "  regexp: only show diffs where a changed line matches regexp\n")
+  (System/exit code))
 
 ;; If object is a uri, the "-rn:m" revision-range format will not work if object
 ;; is no longer present in the head revision, in which case we have to use the

    (list (str path "@" r1) (str path "@" r2))
    (list (str "-r" r1 ":" r2) path)))

;;(defn- assoc-s [m k v]
;; (let [sets (:set m [])]
;;   (assoc m :set (into sets [v]))))
;;(defn- parse-s [x]
;; (let [[nml+key val] (string/split x #"=" 2)
;;       [nml key] (parse-g nml+key)]
;;   [nml key val]))

(defn -main [& args]
;; (let [{:keys [options arguments summary]} (cli/parse-opts args cliopts)
;;       gets (:get options)
;;       sets (:set options)
;;       in   (or (:in  options) *in* )
;;       out  (or (:out options) *out*)]
  (let [object (first args) filt (or (second args) ".*")]
    (if (not object)
      (usage)
      (do
        (diffrevpairs object filt (revpairs (revlist object) object))
        (shutdown-agents)))))

  (:use [clojure.java.shell :only [sh]])
  (:use [clojure.string :only [split split-lines trim]]))

(declare matching-files log svndiff uri? vpaths)

;; Suppress svn user prompts.

