all repos — nixfiles @ eab92f65759d4f95c43b3ec9efd93df72f3a29d1

System and user configuration, managed by nix and home-manager

Emacs: Add completion for yarn-run command
Alan Pearce alan@alanpearce.eu
Tue, 06 Jun 2017 15:15:08 +0200
commit

eab92f65759d4f95c43b3ec9efd93df72f3a29d1

parent

a67a49386bcbef7ad83706e41dc8842c4b0bac58

1 files changed, 2 insertions(+), 1 deletions(-)

jump to
M emacs/.emacs.d/init.orgemacs/.emacs.d/init.org
@@ -564,7 +564,8 @@ (projectile-with-default-dir (projectile-project-root)                 (cmd-to-echo "yarn" (concat "add " package))))
 
             (defun yarn-run (cmd)
-              (interactive "scommand: ")
+              (interactive (list
+                            (projectile-completing-read "command: " (alist-get 'scripts (json-read-file (expand-file-name "package.json" (projectile-project-root)))))))
               (projectile-with-default-dir (projectile-project-root)
                 (cmd-to-echo "yarn" (concat "run " cmd))))