-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add interactive task. No more waiting around for JVM boot if that's y…
…our thing.
- Loading branch information
1 parent
c82fcaf
commit 778a522
Showing
2 changed files
with
38 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
(ns leiningen.interactive | ||
(:require [clojure.string :as string]) | ||
(:use [leiningen.core :only [resolve-task no-project-needed]])) | ||
|
||
(defn not-found [& _] | ||
(println "That's not a task. Use \"lein help\" to list all tasks.")) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
(defn interactive | ||
"Enter an interactive shell for calling tasks without relaunching new JVMs." | ||
[project] | ||
(println "Welcome to Leiningen. Type \"help\" for a list of commands.") | ||
(loop [] | ||
(flush) | ||
(print "lein> ") | ||
(flush) | ||
;; TODO: integrate with tab-completion in jLine | ||
(let [input (.readLine *in*)] | ||
(when input | ||
(let [[task-name & args] (string/split input #"\s") | ||
task (resolve-task task-name not-found)] | ||
(if (@no-project-needed task-name) | ||
(apply task args) | ||
(apply task project args)) | ||
(recur)))))) |
Is it really "lein help"? On #11 it says jus "type help".