licht1stein / babashka.el

Babashka Tasks for Emacs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

babashka.el

Emacs interface for babashka tasks.

MELPA MELPA Stable

Usage

Simply call a task

The main entry point is babashka-tasks. If called from a buffer visiting a file in a project with bb.edn in it, it will look up the directory tree recursively until bb.edn is found, parses it for tasks and offer a menu to select a task to run:

Call a tasks with command line args

If your task accepts command line arguments, just type them after the task name:

Call tasks from any directory

If you want to specify a bb.edn to run tasks from, simply call babashka-tasks with an interactive argument:

C-u M-x babashka-tasks RET

Make it a project-switch-project action

project-switch-project can be extended with custom dispatch actions. To add a dispatch action which runs a Babashka task from the project's root, add babashka-project-tasks to your project-switch-commands list. For example:

(setq project-switch-commands
      '((babashka-project-tasks "Babashka task" "t") ;; <--
        (magit-project-status "Magit status" "m")
        (project-find-file "Find file")
        (project-find-regexp "Find regexp")
        (project-find-dir "Find directory")
        (project-eshell "Eshell")
        ))

Customization

babashka-command - The command used to execute Babashka, if CIDER is loaded, gets its default value from cider-babashka-command, so you don't need to customize both.

babashka-async-shell-command - a single-arity Emacs lisp function to call babashka-command. The default value is async-shell-command, another possible option is detached-shell-command from detached.el package.

babashka-annotation-function - a function to convert tasks hashtable to (task . documentation) alist. The only available option now is babashka--annotation-function.

Installation

Babashka.el is available on MELPA and MELPA Stable and can be installed with:

M-x package-install RET babashka RET

or using use-package ensure feature:

(use-package babashka)

Don't forget to explicitly ensure the installation:

(use-package babashka
  :ensure t)

if use-package-always-ensure is not set.

Versioning

The project uses break versioning, meaning that upgrading from 1.0.x to 1.0.y will always be safe, upgrade to 1.y.0 might break something small, and upgrade to y.0.0. will break almost everything. That was a versioning spec in one sentence, by the way.

Contributing

If you have more ideas about using babashka from Emacs — please submit a PR or a feature request.

About

Babashka Tasks for Emacs

License:GNU General Public License v3.0


Languages

Language:Emacs Lisp 100.0%