 
   (let [sync-start-time (get-start-date (:sync-start-time (:options args)))
         sync-jobs-for-pipelines (set (:sync-jobs (:options args)))
-        selected-pipeline-group-names (set (drop 1 (:arguments args)))]
+        selected-pipeline-group-names (set (:pipeline-groups (:options args)))]
 
     (->> (goapi/get-stages go-url)
          (select-stages selected-pipeline-group-names)

               [""
                "Syncs Go.cd build history with buildviz"
                ""
                "Usage: gosync.clj [OPTIONS] GO_URL [PIPELINE_GROUP] [ANOTHER PIPELINE GROUP] ..."
                ""
                "GO_URL            The URL of the Go.cd installation"
                "PIPELINE_GROUP    Optional name of a pipeline group in Go"
                ""
                "Options"
                options-summary]))

  [["-b" "--buildviz URL" "URL pointing to a running buildviz instance"
    :id :buildviz-url
    :default "http://localhost:3000"]
   ["-f" "--from DATE" "Date from which on builds are loaded, if not specified tries to pick up where the last run finished"
    :id :sync-start-time
    :parse-fn #(tf/parse date-formatter %)]
   ["-j" "--sync-jobs PIPELINE" "Pipeline for which Go jobs will be synced individually and not aggregated inside stage"
    :id :sync-jobs
    :default nil
    :assoc-fn (fn [previous key val] (assoc previous key (conj (get previous key) val)))]
   ["-g" "--pipeline-groups PIPELINE_GROUPS" "Go pipeline groups to be synced, all by default"
    :id :pipeline-groups
    :default nil
    :assoc-fn (fn [previous key val] (assoc previous key (conj (get previous key) val)))]
   ["-h" "--help"]])

