commando.el
is a simple way to let you associate elisp scripts with
a project. Just add a file named .commando
containing your scripts
into your project's root directory. Scripts that use emacs commands
like shell-command
will automatically be run from the project root.
You run scripts by calling M-x commando-run-script
or
(commando-run-script "script-name")
. You should probably bind
it to a keyboard shortcut.
Add commando.el
to your load path.
Add scripts to your .commando file with the commando-add-script
macro.
The code below shows a typical .commando
file.
;; Start the project
(commando-add-script :start
(shell-command "npm start"))
;; Run the test suite
(commando-add-script :run-tests
(shell-command "npm run-tests"))
;; Build iOS executable
(commando-add-script :build-ios
(progn
(shell-command "cordova prepare")
(shell-command "cordova build ios --device")))
;; Build iOS executable and deploy to device
(commando-add-script :run-ios
(progn
(shell-command "cordova prepare")
(shell-command "cordova build ios --device")
(async-shell-command "cordova run ios --device")))
;; Rebuild tags file
(commando-add-script :rebuild-tags
(async-shell-command (format "ctags -ReV -f TAGS %s"
(mapconcat 'identity
(list
"node_modules/phaser/src"
"node_modules/javascript-state-machine/state-machine.js"
"src/js")
" "))))
;; Using git, stage all changes and commit.
(commando-add-script :stage-all-and-commit
(progn
(magit-stage-modified)
(magit-commit (list "-m" (read-string "Enter your commit message: ")))))
commando/current-directory
is a local variable commando provides
when executing your script.
You have access to the following variables in your commando scripts
-
commando/project-root
- The path to the project's root directory -
commando/current-file
- The path to the file currently being viewed in Emacs -
commando/current-directory
- The directory of the current file
-
Improve performance by caching project scripts
-
Add a way to combine scripts
-
Add before and after hooks to scripts
-
Add support for a global commando file
-
Add support for windows