Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require environments to be declared before use in conditionals #120

Open
scizzorz opened this issue May 8, 2020 · 0 comments
Open

Require environments to be declared before use in conditionals #120

scizzorz opened this issue May 8, 2020 · 0 comments
Labels
enhancement New feature or request feedback Feedback wanted

Comments

@scizzorz
Copy link
Member

scizzorz commented May 8, 2020

As I've started to more heavily parameterize my moldfiles, I've found that one of the initial goals of Mold - being a quick source of "what can I do in this project" - is falling apart. I often have something like the following:

if foo {
  var OBJ = "foo"
}
if bar {
  var OBJ = "bar"
}

if dev {
  var ENV = "dev"
}
if prod {
  var ENV = "prod"
}

recipe deploy {
  $ "foo $ENV $OBJ"
}

Which yields a rather useless default command listing, as simply running mold deploy isn't sufficient; you actually need to run mold deploy -a foo -a prod or some other combination. If environments had to be declared ahead of time, the default listing could also describe them as well.

Another feature this could provide would be to enable some sort of automatic enabling of environments under some conditions? That seems like it's a bit bigger of a feature, though. For example, in most CI tools, the environment variable $CI is automatically declared. Because Mold has no way to check for that, I often use a -a ci flag in CI and the corresponding if ci or if ~ci blocks handle special cases for CI/non-CI.

This particular example also makes me wonder if there would be some way to parameterize the recipe differently, but that's another topic

@scizzorz scizzorz added enhancement New feature or request feedback Feedback wanted labels May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feedback Feedback wanted
Projects
None yet
Development

No branches or pull requests

1 participant