babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
borkdude 2021-05-14T09:31:34.312400Z

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.

borkdude 2021-05-14T10:27:21.313Z

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"]

👍 2
borkdude 2021-05-14T10:28:05.313200Z

$ 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=&gt; (require '[babashka.pods :as pods])
nil
user=&gt; (pods/load-pod 'org.babashka/hsqldb "0.0.6")
#:pod{:id "pod.babashka.hsqldb"}

borkdude 2021-05-14T13:48:12.314200Z

absolutely

borkdude 2021-05-14T13:48:21.314400Z

I'll try it

1
borkdude 2021-05-14T13:55:15.314800Z

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

1
borkdude 2021-05-14T13:55:25.315Z

should that also work for bash? I guess bash works a bit different

borkdude 2021-05-14T13:58:59.315500Z

it seems zsh can load bash completions as well, so if we can make it work for bash, it also works for zsh?

2021-05-14T14:03:50.318Z

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 impl

2021-05-14T16:27:35.322700Z

PR 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'

2021-05-14T16:31:22.323Z

👍 1
borkdude 2021-05-14T17:08:54.323300Z

Excellent. Can you also sign the contributors agreement by following this? https://github.com/babashka/book/blob/master/CONTRIBUTING.md

borkdude 2021-05-14T17:23:25.324300Z

@admin055 Shouldn't it autocomplete upon typing bb&lt;space&gt;&lt;TAB&gt; instead of on bb tasks&lt;space&gt;&lt;TAB&gt; ?

2021-05-14T19:28:47.324700Z

OK, I'll take care of both @borkdude 👍

lread 2021-05-14T19:37:36.324900Z

Very cool! Thanks!