Passing argument value to cli Builder

Hi Forum,

I am using the Command Line Squirrel Code Preprocessor Builder.
I know you can use the -D argument to pass some arguments to Build cli
e.g
pleasebuild -DBUILD_TYPE debug raw.device.nut > device.nut
then in the code
@if BUILD_TYPE == “debug”
@include “github:ElectricImpSampleCode/BuilderDemo/logging.nut”
@else
@include “github:ElectricImpSampleCode/BuilderDemo/production.nut”
@endif

Question: Is possible to pass a value like
pleasebuild -DMYVALUE 123 raw.device.nut > device.nut

and use the value=123 as a regular int variable in my Squirrel code ?

I’d recommend using a JSON file of configuration parameters:
pleasebuild --use-directives ~/path/to/directives.json
Yes you can then reference any parameter in the code as
local myvar = @{MY_JSON_PARAMETER};

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.