fix up formatting in cli usage summary

This commit is contained in:
Gered 2016-06-29 09:48:44 -04:00
parent c1fcaa4837
commit a0ef0d48e0
2 changed files with 11 additions and 2 deletions

View file

@ -1,7 +1,9 @@
(ns mtgcoll.cli
(:require
[clojure.string :as string]
[clojure.tools.cli :as cli]))
[clojure.tools.cli :as cli])
(:use
mtgcoll.utils))
(def ^:private cli-options
[["-c" "--config EDN-CONFIG-FILE"
@ -18,7 +20,7 @@
(defn- ->actions-summary
[]
(->> actions
(map (fn [[action desc]] (str " " action "\t\t" desc)))
(map (fn [[action desc]] (str " " (pad-string 20 action) " " desc)))
(string/join \newline)))
(defn- ->usage-string

View file

@ -50,3 +50,10 @@
body (:body response)]
(if-not (empty? body)
body)))
(defn pad-string
[n s & [c]]
(let [c (or c \space)]
(if (< (count s) n)
(->> (repeat c) (concat s) (take n) (string/join))
s)))