-
-
Save programmer-ke/f348cb13581382cfa448c7b99850a870 to your computer and use it in GitHub Desktop.
Easily start scaffold-eth commands in separate terminals in emacs
This file contains hidden or 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
;; Easily start/stop the scaffold eth commands in separate terminals | |
;; Ensure you're in the scaffold-eth root directory | |
;; terminal names: *yarn-chain*, *yarn-start*, *yarn-deploy* | |
;; run with M-x scaffold-eth... Optionally map to keybinding | |
(defun scaffold-eth/stop () | |
(interactive) | |
(ignore-errors (kill-buffer "*yarn-deploy*")) | |
(ignore-errors (kill-buffer "*yarn-start*")) | |
(ignore-errors (kill-buffer "*yarn-chain*"))) | |
(defun scaffold-eth/start () | |
(interactive) | |
(if (or | |
(get-buffer "*yarn-chain*") | |
(get-buffer "*yarn-start*") | |
(get-buffer "*yarn-deploy*")) | |
(message "Already running, use the stop command first") | |
(progn | |
(ansi-term "/bin/bash" "yarn-chain") | |
(comint-send-string "*yarn-chain*" "yarn chain\n") | |
(sleep-for 3) ; give the chain a few seconds to go up | |
(ansi-term "/bin/bash" "yarn-start") | |
(comint-send-string "*yarn-start*" "yarn start\n") | |
(ansi-term "/bin/bash" "yarn-deploy") | |
(comint-send-string "*yarn-deploy*" "yarn deploy\n")))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment