b2 icon indicating copy to clipboard operation
b2 copied to clipboard

Access CLI set variables independently.

Open grafikrobot opened this issue 3 years ago • 1 comments

Make sure you completed the following tasks

Describe your use case

It's useful to distinguish between variables set in the environment, by the -sX=Y CLI option, and locally or globally in Jam files for configuration use. But it's currently convoluted, i.e. hard, to check if a variable is set because it's given with -sX=Y or in environment as both use the global module to store the variables.

Describe the solution you'd like

Create a way to store the -sX=Y variables separately. Likeliest implementation if to add those variables to a .CLI module like we do with .ENVIRON module.

grafikrobot avatar Jul 12 '22 14:07 grafikrobot

For context: Given a possible setting ICU_PATH it would make sense to have the following order possible:

  • When -s ICU_PATH=x is given, use x
  • Otherwise if path-constant ICU_PATH : y is set in the project-config, use y
  • Otherwise if an env variable ICU_PATH exists use that
  • Otherwise empty

Currently the combination that env variables and CLI args are returned by module.peek makes this impossible which means that either you cannot overwrite the project-config with -s or an env variable would overwrite the project-config. Both don't make sense from a users perspective.

Flamefire avatar Jul 12 '22 15:07 Flamefire