pesterhazy / bash2bb

44 stars 1 forks source link

`set -eu` translated as empty `(do)` #4

Closed dundalek closed 1 year ago

dundalek commented 1 year ago

I have some scripts starting with set -eu. Given babashka has a sane default by throwing on error, it makes sense the setting can be ignored.

This is a minor detail, output ends up with extraneous (do) which could be omitted.

set -eu
echo a
#!/usr/bin/env bb

(require (quote [babashka.process :refer [shell pipeline pb]]))
(do)
(shell "echo" "a")
pesterhazy commented 1 year ago

Fixed! I had a baked in assumption in the code that every ast element translated into exactly one form. Removing this (incorrect) assumption required a bit of refactoring.