Released pod-babashka-aws and sql pods (hsqldb, postgres and mssql) as static linux binaries, also through the pod registry. This should make them suitable to run directly from the registry even in alpine images and other linux distros.
Small demo of bb in Alpine image with hsqldb pod baked in:
FROM alpine:3.7
RUN apk add --no-cache curl
RUN curl -sLO <https://github.com/babashka/babashka/releases/download/v0.4.1/babashka-0.4.1-linux-amd64-static.tar.gz>
RUN tar -xzvf babashka-0.4.1-linux-amd64-static.tar.gz
RUN ./bb -e "(babashka.pods/load-pod 'org.babashka/hsqldb \"0.0.6\")"
ENTRYPOINT ["./bb"]
$ docker run --rm -it f9713317a1a8ba02960741660467feba187107992af07c03f80d3277baf15bed
Babashka v0.4.1 REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=> (require '[babashka.pods :as pods])
nil
user=> (pods/load-pod 'org.babashka/hsqldb "0.0.6")
#:pod{:id "pod.babashka.hsqldb"}
absolutely
I'll try it
Nice! It worked for me when adding this to .zshrc
:
autoload -Uz compinit
compinit
echo "hello"
_bb_tasks() {
local matches=(`bb tasks |tail -n +3 |cut -f1 -d ' '`)
compadd -a matches
_files # autocomplete filenames as well
}
compdef _bb_tasks bb
should that also work for bash? I guess bash works a bit different
it seems zsh can load bash completions as well, so if we can make it work for bash, it also works for zsh?
https://stackoverflow.com/questions/3249432/can-a-bash-tab-completion-script-be-used-in-zsh
An example bash autocompletion from aws-vault:
_aws-vault_bash_autocomplete() {
local cur prev opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
opts=$( ${COMP_WORDS[0]} --completion-bash "${COMP_WORDS[@]:1:$COMP_CWORD}" )
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
}
complete -F _aws-vault_bash_autocomplete -o default aws-vault
You probably don't need all that. I think you only need to fill out COMPREPLY with matches from zsh implPR done for Fish shell too 👍 https://github.com/babashka/book/pull/30
function __bb_complete_tasks
if not test "$__bb_tasks"
set -g __bb_tasks (bb tasks |tail -n +3 |cut -f1 -d ' ')
end
printf "%s\n" $__bb_tasks
end
complete -f -c bb -n '__fish_seen_subcommand_from tasks' -a "(__bb_complete_tasks)" -d 'List tasks'
Excellent. Can you also sign the contributors agreement by following this? https://github.com/babashka/book/blob/master/CONTRIBUTING.md
@admin055 Shouldn't it autocomplete upon typing bb<space><TAB>
instead of on bb tasks<space><TAB>
?
OK, I'll take care of both @borkdude 👍
Very cool! Thanks!