Skip to content

Conversation

@jaredponn
Copy link
Contributor

@jaredponn jaredponn commented Oct 24, 2023

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
    

    Note the

    mkdir: cannot create directory ‘autogen’: File exists
    mkdir: cannot create directory ‘.work’: File exists
    

    Not sure if there's a good reason to have this output here, but adding the -p flag will silence this.

@jaredponn jaredponn self-assigned this Oct 25, 2023
Copy link
Contributor

@bladyjoker bladyjoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment, please double check

@jaredponn jaredponn added this pull request to the merge queue Oct 26, 2023
Merged via the queue into main with commit 2eed894 Oct 26, 2023
@jaredponn jaredponn deleted the jared/hotfix-lbf-porcelain-scripts branch October 26, 2023 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants