Following #121 , this PR does some minor improvements to the lbf frontend scripts (I'll call these porcelain in contrast to the low level plumbing -- this is the nomenclature that git uses which has a similar architecture! See man gitcore-tutorial)
Replaced $@ with "$@" in the lbf scripts. The reason why this is important is because if there's a single argument with a space in it, the former will make it two arguments instead of a single argument.
Moreover, as a minimal example, we can see that shellcheck (from CI) doesn't like $@ either:
Given: test.bash as follows
#!/bin/bash
echo $@
We can see that shellcheck gets angry
In test.bash line 3:
echo $@
^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements.
For more information:
https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ...
Added -p to mkdir
Previously, if we ran any of the lbf shell scripts twice, we'd get something like:
$ nix develop .#lb
trace: WARNING: 9.2.5 is out of date, consider using 9.2.7.
$ lbf-prelude-to-haskell TEST.lbf
[lbf][INFO] Success from: /nix/store/hn87z4b5qaw1888zys761nyxwm2gyxal-lambda-buffers-compiler-exe-lbc-0.1.0.0/bin/lbc compile --input-file .work/compiler-input.pb --output-file .work/compiler-output.pb
[lbf][INFO] Compilation OK
[lbf][INFO] Success from: /nix/store/9s58v4ad8bk4qq0ml0cirpcgfr1nfaj8-lbg-haskell/bin/lbg-haskell --input .work/codegen-input.pb --output .work/codegen-output.pb --gen-dir autogen --gen-class Prelude.Eq --gen-class Prelude.Json '--config=/nix/store/7h1hnhy5al8v272c4l1vrsxc2h3i9si4-codegen-configs/haskell-prelude-base.json' TEST
[lbf][INFO] Codegen OK
$ lbf-prelude-to-haskell TEST.lbf
mkdir: cannot create directory ‘autogen’: File exists
mkdir: cannot create directory ‘.work’: File exists
[lbf][INFO] Success from: /nix/store/hn87z4b5qaw1888zys761nyxwm2gyxal-lambda-buffers-compiler-exe-lbc-0.1.0.0/bin/lbc compile --input-file .work/compiler-input.pb --output-file .work/compiler-output.pb
[lbf][INFO] Compilation OK
[lbf][INFO] Success from: /nix/store/9s58v4ad8bk4qq0ml0cirpcgfr1nfaj8-lbg-haskell/bin/lbg-haskell --input .work/codegen-input.pb --output .work/codegen-output.pb --gen-dir autogen --gen-class Prelude.Eq --gen-class Prelude.Json '--config=/nix/store/7h1hnhy5al8v272c4l1vrsxc2h3i9si4-codegen-configs/haskell-prelude-base.json' TEST
[lbf][INFO] Codegen OK
Following #121 , this PR does some minor improvements to the
lbf
frontend scripts (I'll call these porcelain in contrast to the low level plumbing -- this is the nomenclature thatgit
uses which has a similar architecture! Seeman gitcore-tutorial
)Replaced
$@
with"$@"
in thelbf
scripts. The reason why this is important is because if there's a single argument with a space in it, the former will make it two arguments instead of a single argument.Moreover, as a minimal example, we can see that
shellcheck
(from CI) doesn't like$@
either:Given:
test.bash
as followsWe can see that
shellcheck
gets angryAdded
-p
tomkdir
Previously, if we ran any of thelbf
shell scripts twice, we'd get something like:Note the
Not sure if there's a good reason to have this output here, but adding the
-p
flag will silence this.