Make task name column wider in the lein -h output

To make sure longer task names such as show-profiles do not collide
with task description.
This commit is contained in:
Michael S. Klishin 2012-07-23 01:02:31 +04:00
parent 1bac2ef834
commit d95deb63fe

View file

@ -5,6 +5,11 @@
[bultitude.core :as b] [bultitude.core :as b]
[leiningen.core.main :as main])) [leiningen.core.main :as main]))
(def ^{:const true
:private true
:doc "How wide the task name column is in the list of tasks produced by lein -h"}
task-name-column-width 20)
(defn tasks (defn tasks
"Return a list of symbols naming all visible tasks." "Return a list of symbols naming all visible tasks."
[] []
@ -83,7 +88,7 @@
ns-summary (:doc (meta (find-ns (doto task-ns require)))) ns-summary (:doc (meta (find-ns (doto task-ns require))))
first-line (first (.split (help-for {} task-name) "\n"))] first-line (first (.split (help-for {} task-name) "\n"))]
;; Use first line of task docstring if ns metadata isn't present ;; Use first line of task docstring if ns metadata isn't present
(str task-name (apply str (repeat (- 13 (count task-name)) " ")) (str task-name (apply str (repeat (- task-name-column-width (count task-name)) " "))
(or ns-summary first-line))) (or ns-summary first-line)))
(catch Throwable e (catch Throwable e
(binding [*out* *err*] (binding [*out* *err*]