Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow to pass command line args to --exec.

  • Loading branch information...
commit 35729bf2ab77e1eef075f4f7301b1921790b6e1f 1 parent 4949dfb
@mtyaka authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 src/leiningen/oneoff.clj
View
12 src/leiningen/oneoff.clj
@@ -101,11 +101,13 @@ for a one-off project."
Short forms (-e, -r, -c, -s) may be used instead.
If <command> is omitted, --exec is assumed."))
-(defn execute-script [script]
+(defn execute-script [script & args]
(let [project (oneoff-project script)
+ args (when args (vec args))
form `(do
~defdeps-defmacro-form
- (clojure.main/load-script ~script))]
+ (binding [*command-line-args* ~args]
+ (clojure.main/load-script ~script)))]
(leiningen.compile/eval-in-project project form)))
(defn start-repl-server [script]
@@ -134,13 +136,13 @@ Syntax: lein oneoff <command> <file>
If <command> is omitted, --exec is assumed.
See http://github.com/mtyaka/lein-oneoff for more information."
- ([cmd script]
+ ([cmd script & args]
(case cmd
- ("--exec" "-e") (execute-script script)
+ ("--exec" "-e") (apply execute-script script args)
("--repl" "-r") (start-repl-server script)
("--classpath" "-c") (print-classpath script)
("--swank" "-s") (start-swank-server script)
- (print-usage)))
+ (apply oneoff "--exec" cmd script args)))
([script]
(oneoff "--exec" script))
([]
Please sign in to comment.
Something went wrong with that request. Please try again.