     (.delete (file plugins-path
                (plugin-standalone-filename group name version)))))
 
+;; TODO: move subtask documentation support to help namespace.
 (defn- formatted-docstring [command docstring padding]
   (apply str
     (replace

                              extract-jar
                              get-default-uberjar-name)]
        [clojure.java.io :only (file)])
  (:require [leiningen.install])
  (:import [java.util.zip ZipOutputStream]
           [java.io File FileOutputStream]))


        [(str (:name (meta subtask))) (:doc (meta subtask))])
      [#'help #'install #'uninstall])))

(defn help []
  (let [help-map (get-help-map)
        longest-key-length (apply max (map count (keys help-map)))]
    (string/join "\n" (concat
                       ["Manage user-level plugins.\n"
                        "Subtasks available:\n"]
                       (for [[subtask doc] help-map]
                         (formatted-help subtask doc longest-key-length))))))

(defn ^{:help-arglists '([subtask project-name version])} plugin
  ([] (println (help)))
  ([_] (plugin))
  ([_ _] (plugin))
  ([subtask project-name version]
    (case subtask
      "install" (install project-name version)
      "uninstall" (uninstall project-name version)
      (help))))
