Skip to content

Commit

Permalink
Merge pull request technomancy#680 from bruceadams/master
Browse files Browse the repository at this point in the history
Intercept "help" after task name, issue technomancy#629
  • Loading branch information
technomancy committed Jul 12, 2012
2 parents 7a81227 + d233dc6 commit 6abdc17
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions leiningen-core/src/leiningen/core/main.clj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
(get (:aliases project) task-name)
task-name "help"))

(defn help? [s]
(#{"help" "--help" "-h" "-?"} s))

(defn task-args [args project]
(if (help? (second args))
["help" [(first args)]]
[(lookup-alias (first args) project) (rest args)]))

(def ^:dynamic *debug* (System/getenv "DEBUG"))

(defn debug [& args]
Expand Down Expand Up @@ -141,11 +149,11 @@ or by executing \"lein upgrade\". ")

(defn -main
"Run a task or comma-separated list of tasks."
[& [task-name & args]]
[& raw-args]
(user/init)
(let [project (if (.exists (io/file "project.clj"))
(project/init-project (project/read)))
task-name (lookup-alias task-name project)]
[task-name args] (task-args raw-args project)]
(when (:min-lein-version project)
(verify-min-version project))
(http-settings)
Expand Down

0 comments on commit 6abdc17

Please sign in to comment.