fix up formatting in cli usage summary
This commit is contained in:
parent
c1fcaa4837
commit
a0ef0d48e0
|
@ -1,7 +1,9 @@
|
||||||
(ns mtgcoll.cli
|
(ns mtgcoll.cli
|
||||||
(:require
|
(:require
|
||||||
[clojure.string :as string]
|
[clojure.string :as string]
|
||||||
[clojure.tools.cli :as cli]))
|
[clojure.tools.cli :as cli])
|
||||||
|
(:use
|
||||||
|
mtgcoll.utils))
|
||||||
|
|
||||||
(def ^:private cli-options
|
(def ^:private cli-options
|
||||||
[["-c" "--config EDN-CONFIG-FILE"
|
[["-c" "--config EDN-CONFIG-FILE"
|
||||||
|
@ -18,7 +20,7 @@
|
||||||
(defn- ->actions-summary
|
(defn- ->actions-summary
|
||||||
[]
|
[]
|
||||||
(->> actions
|
(->> actions
|
||||||
(map (fn [[action desc]] (str " " action "\t\t" desc)))
|
(map (fn [[action desc]] (str " " (pad-string 20 action) " " desc)))
|
||||||
(string/join \newline)))
|
(string/join \newline)))
|
||||||
|
|
||||||
(defn- ->usage-string
|
(defn- ->usage-string
|
||||||
|
|
|
@ -50,3 +50,10 @@
|
||||||
body (:body response)]
|
body (:body response)]
|
||||||
(if-not (empty? body)
|
(if-not (empty? body)
|
||||||
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)))
|
||||||
|
|
Loading…
Reference in a new issue