diff --git a/src/babashka/impl/tasks.clj b/src/babashka/impl/tasks.clj index 0c41b168..9179c1b8 100644 --- a/src/babashka/impl/tasks.clj +++ b/src/babashka/impl/tasks.clj @@ -122,10 +122,11 @@ (let [tasks (:tasks @bb-edn)] (if (seq tasks) (let [names (keys tasks) - raw-names (filter symbol? names) - names (map str raw-names) + names (filter symbol? names) + names (map str names) names (remove #(str/starts-with? % "-") names) names (remove #(:private (get tasks (symbol %))) names) + names (sort names) longest (apply max (map count names)) fmt (str "%1$-" longest "s")] (println "The following tasks are available:") diff --git a/test/babashka/bb_edn_test.clj b/test/babashka/bb_edn_test.clj index 68a969c3..fd19609e 100644 --- a/test/babashka/bb_edn_test.clj +++ b/test/babashka/bb_edn_test.clj @@ -90,11 +90,7 @@ {:task '(+ 1 2 3) :private true}}} (let [res (test-utils/bb nil "tasks")] - (is (str/includes? res "The following tasks are available:")) - (is (str/includes? res "task1 task1 doc")) - (is (str/includes? res "task2 task2 doc")) - (is (not (str/includes? res "task3"))) - (is (not (str/includes? res "task4")))))) + (is (= "The following tasks are available:\n\ntask1 task1 doc\ntask2 task2 doc\n" res))))) ;; TODO: ;; Do we want to support the same parsing as the clj CLI?