From 5b30bcb0c89b3e012857ed11f0658f0ac027f6d5 Mon Sep 17 00:00:00 2001 From: jiro4989 Date: Sun, 18 Nov 2018 01:02:21 +0900 Subject: [PATCH] =?UTF-8?q?[clean]=E9=96=A2=E6=95=B0=E3=81=AE=E9=A0=86?= =?UTF-8?q?=E7=95=AA=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/meme/core.clj | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/meme/core.clj b/src/meme/core.clj index 5cd2b0d..2df6d5d 100644 --- a/src/meme/core.clj +++ b/src/meme/core.clj @@ -13,6 +13,17 @@ (map #(str/lower-case %)) distinct)) +(defn format-line + "オプションごとの出力を返す" + [m options] + (let [{:keys [none padding-size delimiter]} options + weight (:weight m) + n (:name m)] + ; オプション数が増えたら出力が変わる可能性があるためcondを使用 + (cond + none (format "%s" n) + :else (format (str "%" padding-size "d" delimiter "%s") weight n)))) + (def cli-options ; 重み数値の空白詰め桁数 [["-p" "--padding-size int" "padding size" @@ -37,17 +48,6 @@ "options:" summary])) -(defn format-line - "オプションごとの出力を返す" - [m options] - (let [{:keys [none padding-size delimiter]} options - weight (:weight m) - n (:name m)] - ; オプション数が増えたら出力が変わる可能性があるためcondを使用 - (cond - none (format "%s" n) - :else (format (str "%" padding-size "d" delimiter "%s") weight n)))) - (defn -main [& args] (let [{:keys [options arguments errors summary]} (parse-opts args cli-options)]