Skip to content

russmatney/bb-task-completion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BB Task Completion

Created to toy with zsh completion for bb’s new tasks feature.

Update: BB-Book recommended solution

A simpler version of the feature implemented in this repo can be achived by adding the following to your zshrc. (From the Babashka book.)

_bb_tasks() {
    local matches=(`bb tasks |tail -n +3 |cut -f1 -d ' '`)
    compadd -a matches
    _files # autocomplete filenames as well
}
compdef _bb_tasks bb

Resources

BB Tasks spec/issue

bb.edn examples:

Zsh completion help:

Zsh autocompletion

Something like the following is typical to get zsh completion working (see the first few paragraphs here for reference):

# add completion files to fpath
fpath=(~/.zsh/completion $fpath)

# initialize completion system
autoload -Uz compinit && compinit -i

BB task completion

Completion for bb requires a zsh file in /.zsh/completion/_bb (or wherever you append your fpath).

See ./_bb and ./bb_task_completion.clj for a working implementation.

Installation

This repo was implemented as a proof of concept, and is not at all intended as a final product for bb-based completion. However if you want to try it, something like this could work as a manual install process.

# clone this repo to ~/russmatney/bb-task-completion
ln -s ~/russmatney/bb-task-completion/bb_task_completion.clj ~/.zsh/bb_task_completion.clj
ln -s ~/russmatney/bb-task-completion/_bb ~/.zsh/completion/_bb

Open questions

  • What’s the expected installation process for bb users?

    We can probably get people to add a `source <(some-bb-command)` line to do the work

  • Where should the bb_task_completion.clj script/logic live? Right now the task uses a hard-coded helper script to parse the bb.edn and format a string. Maybe this should live somewhere in the babashka repo itself?

    As implemented, users will need to install two scripts, which is not ideal.

Next steps

  • Completion for the rest of the bb cli options?

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published