 
 (defn exit [message]
   (println message)
-  (println "usage: hbase-region-inspector QUORUM[/ZKPORT] PORT")
+  (println "usage: hbase-region-inspector [--read-only] QUORUM[/ZKPORT] PORT")
   (System/exit 1))
 
 (defn -main [& args]
-  (when (not= 2 (count args)) (exit "invalid number of arguments"))
-  (try
-    (let [[zk port] args
-          port (Integer/parseInt port)]
-      (bootstrap zk port true))
-    (catch NumberFormatException e (exit "invalid port"))))
-
+  (let [[opts args] ((juxt filter remove) #(.startsWith % "-") args)
+        opts (set (map #(keyword (str/replace % #"^-*" "")) opts))]
+    (reset! read-only? (contains? opts :read-only))
+    (when (not= 2 (count args)) (exit "invalid number of arguments"))
+    (try
+      (let [[zk port] args
+            port (Integer/parseInt port)]
+        (bootstrap zk port true))
+      (catch NumberFormatException e (exit "invalid port")))))
+

(ns hbase-region-inspector.core
  (:require [clojure.pprint :refer [pprint]]
            [ring.adapter.jetty :refer [run-jetty]]
            [ring.util.response :refer [response content-type resource-response]]
            [ring.middleware.defaults :refer [wrap-defaults api-defaults site-defaults]]

(defroutes app-routes
  (GET "/" []
       (render-file "public/index.html" {:zookeeper @zookeeper
                                         :read-only @read-only?
                                         :updated-at (:updated-at @cached)}))
       ;; (content-type (resource-response "index.html" {:root "public"})
       ;;               "text/html"))
