From e4d82b87be4e908817a64099896ed0826b5eb039 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Thu, 25 Mar 2021 11:19:21 +0100 Subject: [PATCH] Fix help --- src/babashka/main.clj | 2 +- test/babashka/bb_edn_test.clj | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/babashka/main.clj b/src/babashka/main.clj index 7e141bcb..7b8fe286 100644 --- a/src/babashka/main.clj +++ b/src/babashka/main.clj @@ -154,7 +154,7 @@ Use -- to separate script command line args from bb command line args. task (get-in @bb-edn [:tasks k]) {:keys [:args]} (decode-task task) main (first args) - help-text (:task/help (meta task))] + help-text (:help (meta task))] (if help-text [(println help-text) 0] (if main diff --git a/test/babashka/bb_edn_test.clj b/test/babashka/bb_edn_test.clj index 0c143ea6..0beb6f41 100644 --- a/test/babashka/bb_edn_test.clj +++ b/test/babashka/bb_edn_test.clj @@ -91,12 +91,13 @@ (with-config {:tasks {:describe [:babashka "-e" "(+ 1 2 3)"]}} (is (= 6 (bb :describe))))) -#_(deftest help-task-test - (with-config {:tasks {:cool-task ^{:task/help "Usage: bb :cool-task +(deftest help-task-test + (with-config "{:tasks {:cool-task + ^{:help \"Usage: bb :cool-task -Addition is a pretty advanced topic. Let us start with the identity element -0. ..."} - [:babashka "-e" "(+ 1 2 3)"]}} + Addition is a pretty advanced topic. Let us start with the identity element + 0. ...\"} + [:babashka -e (+ 1 2 3)]}}" (is (str/includes? (apply test-utils/bb nil (map str [:help :cool-task])) "Usage: bb :cool-task"))))