                [(format "Option \"--%s\" conflicts with the command \"%s\""
                         (name option) command)])))))
 
+(defn- prepare-common-args
+  "Prepare common arguments."
+  [arguments options]
+  (let [source (nth arguments 0)
+        tenant (nth arguments 1)
+        cass-hosts (str/split (nth arguments 2) #",")
+        es-url (nth arguments 3)
+        rollups (->> (:rollups options [])
+                     (filter #(not (nil? %)))
+                     (flatten)
+                     (apply hash-map))
+        options (assoc options :rollups rollups)]
+    {:source source :tenant tenant :cass-hosts cass-hosts :es-url es-url
+     :options options}))
+
 (defn- run-migrate
   "Run command 'migrate'."
   [command arguments options summary]

                           :disable-path-store :log-file :log-level
                           :disable-log :stop-on-error :disable-progress}
                 options)
  (let [source (nth arguments 0)
        tenant (nth arguments 1)
        cass-hosts (str/split (nth arguments 2) #",")
        es-url (nth arguments 3)
        rollups (->> (:rollups options [])
                     (filter #(not (nil? %)))
                     (flatten)
                     (apply hash-map))]
    (core/validate source tenant cass-hosts es-url
                   (assoc options :rollups rollups))))

(defn- run-list
  "Run command 'list'."

                           :disable-path-store :log-file :log-level
                           :disable-log :stop-on-error :disable-progress}
                 options)
  (let [{:keys [source tenant cass-hosts es-url
                options]} (prepare-common-args arguments options)]
    (core/migrate source tenant cass-hosts es-url options)))

(defn- run-validate
  "Run command 'validate'."
