Skip to content

Conditional code generation in commands that depends on generate --env value. #683

@tzah4748

Description

@tzah4748

I would like to be able to include certain parts of the code only in development/production environment.
The idea resembles how a C compiler's preprocessor uses #ifdef sections.

I know that by default the env is only taken into consideration at generation time, I would expect to be able to access it in the command itself to define sections that should be generated according to its value.

For example (The syntax can change to fit your taste) :
download_command.sh

# command.env.production
echo "This will only be included in the final script if --env production was given to bashly generate"
echo "This too, until saying otherwise, all code after the above commend is included only in production"
# command.env.development
echo "This will only be included in development"
# command.env
# OR alternatively
# command.env.~
echo "This will be added in any env, which should be of course the default case :)"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions