Add sorting and task/description
This commit is contained in:
parent
b69ec8fc17
commit
6abe9a6851
2 changed files with 13 additions and 10 deletions
|
|
@ -157,13 +157,14 @@ Use -- to separate script command line args from bb command line args.
|
|||
,) ;; end defn
|
||||
|
||||
(defn print-tasks [tasks]
|
||||
(println "The following tasks are available:")
|
||||
(println)
|
||||
(doseq [k (keys tasks)]
|
||||
(println k))
|
||||
(println)
|
||||
(println "Run bb :help <task> to view help of a specific task.")
|
||||
[nil 0])
|
||||
(let [tasks (into (sorted-map) tasks)]
|
||||
(println "The following tasks are available:")
|
||||
(println)
|
||||
(doseq [[k v] tasks]
|
||||
(println k (:task/description v)))
|
||||
(println)
|
||||
(println "Run bb :help <task> to view help of a specific task.")
|
||||
[nil 0]))
|
||||
|
||||
(defn print-describe []
|
||||
(println
|
||||
|
|
|
|||
|
|
@ -123,12 +123,14 @@ Addition is a pretty advanced topic. Let us start with the identity element
|
|||
(deftest list-tasks-test
|
||||
(with-config {:tasks {:cool-task-1 {:task/type :babashka
|
||||
:args ["-e" "(+ 1 2 3)"]
|
||||
:task/description "Return the sum of 1, 2 and 3."
|
||||
:task/help "Usage: bb :cool-task
|
||||
|
||||
Addition is a pretty advanced topic. Let us start with the identity element
|
||||
0. ..."}
|
||||
:cool-task-2 {:task/type :babashka
|
||||
:args ["-e" "(+ 1 2 3)"]
|
||||
:task/description "Return the sum of 4, 5 and 6."
|
||||
:args ["-e" "(+ 4 5 6)"]
|
||||
:task/help "Usage: bb :cool-task
|
||||
|
||||
Addition is a pretty advanced topic. Let us start with the identity element
|
||||
|
|
@ -136,8 +138,8 @@ Addition is a pretty advanced topic. Let us start with the identity element
|
|||
(let [res (apply test-utils/bb nil
|
||||
(map str [:tasks]))]
|
||||
(is (str/includes? res "The following tasks are available:"))
|
||||
(is (str/includes? res ":cool-task-1"))
|
||||
(is (str/includes? res ":cool-task-2")))))
|
||||
(is (str/includes? res ":cool-task-1 Return the"))
|
||||
(is (str/includes? res ":cool-task-2 Return the")))))
|
||||
|
||||
(deftest main-task-test
|
||||
(with-config {:paths ["test-resources/task_scripts"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue