I think using lazbuild for this is ok.
It really rather is a dry run.
Still fuzzy on the exact interface...
I don't like the "-only" in the option. (at the very least not as first token, but in general not at all)
Also it seems zamtmn wants to have more than just the macro values.
Because the simplest option to print the macro values would be:
lazbuild --dry-run --show-macro-value=TargetCPU,TargeOS
TargetCPU=x86-64
TargetOS=Win64
Or just show
all macros:
lazbuild --dry-run --show-macro-values
TargetCPU=x86-64
TargetOS=Win64
....
But the proposed solution is
not "show macro values", it is "
parse random text and show result with macros replaced".
I am not sure, if that is the better option (I can see how it might be used, if you have a text (e.g., a path) with macros).
The question is, if just because we already have that parser in lazbuild, then should lazbuild be call-able as such a parser? Not sure. It's one step further from it's purpose. Yet it's convenient.
In any case (and maybe I did not make it clear enough before) => if it should act as a parser (rather that just (verbose/debug) printing the macro values) then the option needs yet a different name.
Something like (and that is not the final answer, probably needs a better idea):
lazbuild --replace-macros-in-text="foo($TargetOS)" ## Strongly disliking this version / Objecting to it
lazbuild --replace-macros-in-text < input.txt
echo "foo($TargetOS) | lazbuild --replace-macros-in-text
"
The point here is that lazbuild now takes an extra input: the text-to-be-translated.
The first version (supply text as argument) is misleading. It does not bring forth the fact that "--replace-macros-in-text" is an alternative action (instead of "build").
IMHO, if inlined it calls for --dry-run or without dry run should do a build too.
Where as the 2 option that have just "--replace-macros-in-text" (with no text as part of it) read like an action. They are like "--create-makefile".
If the text must be in the command line, it would be possible to do:
lazbuild --replace-macros-in-text --input-text="foo($TargetOS)"
Then again, we have a clear command/action.
About splitting LazBuild:
It uses units which are also used by the IDE. Many of them depend on LCL while they should not. For example units dealing with a project and with a package should not depend on LCL.
The underlying code should be split into packages and dependencies should be reduced. It is an unbelievably hard task.
That is off topic. And not a requirement for the current add-on. (And - in some years - maybe achieved by the concept of ide/packages, that has now been started)