summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franckcuny@gmail.com>2016-08-03 20:46:21 -0700
committerFranck Cuny <franckcuny@gmail.com>2016-08-03 20:52:39 -0700
commitbf8902a640bb6f939afa3f416225065eb7c47059 (patch)
treeb664bcf80901f759bb54162f119d22c46897969e
parentSilent warnings in pants. (diff)
downloadpants.el-bf8902a640bb6f939afa3f416225065eb7c47059.tar.gz
Add a new option: `pants-extra-args'.
This option is set to "" by default. It can be used to specify any extra
option that will be used with every call to pants (for example: -q).

Closes #4.
-rw-r--r--README.md5
-rw-r--r--pants.el11
2 files changed, 11 insertions, 5 deletions
diff --git a/README.md b/README.md
index 6be5f70..818a99f 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,8 @@ Then update your emacs' configuration:
   :config
   (progn
     (setq pants-source-tree-root "/Users/fcuny/src/source"
-          pants-bury-compilation-buffer t)))
+          pants-bury-compilation-buffer t
+          pants-extra-args "-q")))
 ```
 
 ## Configuration
@@ -39,6 +40,8 @@ There's a few variables that you can set:
 
 * **pants-bury-compilation-buffer**: Set to true if you want to bury the compilation buffer after running successfully a command
 
+* **pants-extra-args**: Optional arguments to use with every call to `pants` (for example: "-q")
+
 ## Usage
 
 ### Go to the closest BUILD file
diff --git a/pants.el b/pants.el
index 97557b8..7e5a7a9 100644
--- a/pants.el
+++ b/pants.el
@@ -16,6 +16,9 @@
 (defcustom pants-exec-name "pants"
   "Path to the pants executable. This variable must be set.")
 
+(defcustom pants-extra-args ""
+  "Extra arguments to pass to the pants executable.")
+
 (defcustom pants-exec-args "--no-colors"
   "Arguments to the pants executable. Default is '--no-colors'")
 
@@ -48,12 +51,12 @@
 
 (defun pants--build-command ()
   "Returns the complete command to run."
-  (format "%s%s --config-override=%s%s %s"
-          (pants--get-source-tree) pants-exec-name (pants--get-source-tree) pants-ini pants-exec-args))
+  (format "%s%s %s --config-override=%s%s %s"
+          (pants--get-source-tree) pants-exec-name pants-extra-args (pants--get-source-tree) pants-ini pants-exec-args))
 
 (defun pants--python-repl-action (target)
   "Starts a Python REPL."
-  (let ((pants-repl-command (format "%s -q repl %s" (pants--build-command) target)))
+  (let ((pants-repl-command (format "%s repl %s" (pants--build-command) target)))
     (set (make-local-variable 'default-directory) pants-source-tree-root)
     (set (make-local-variable 'python-shell-exec-path) '(pants-source-tree-root))
     (set (make-local-variable 'python-shell-interpreter) pants-source-tree-root)
@@ -91,7 +94,7 @@
 
 (defun pants--build-target-list (file action)
   "Generates a list of existing targets"
-  (let ((build-command (format "%s -q list %s:" (pants--build-command) file))
+  (let ((build-command (format "%s list %s:" (pants--build-command) file))
         targets target)
     (set (make-local-variable 'default-directory) (pants--get-source-tree))
     (with-temp-buffer