Details
-
Suggestion
-
Resolution: Unresolved
-
P4: Low
-
1.0.0
-
None
Description
QBS should support a syntax for passing the values of its own variables on the command line by expanding identifiers (i.e. alphanumeric + underscore, cannot start with digit) prefixed with '@' into the value of qbs.whatever
For example, @targetOS would be expanded to the value of qbs.targetOS.
As an example of a use case, perhaps a user wants their install directory to be named according to the platform and architecture. They should be able to write:
qbs install --install-root builds/@targetOS-@architecture
and, assuming they are running on a 64-bit Linux system, expect their build to be installed to builds/linux-x86_64.
Some things to think about:
- Do we support expansion of variables beyond just qbs.*?
- If we do allow this, are there potential problems with recursive definitions? i.e. can running a command with a @foo variable be dependent on the result of running such a command?
- How can we provide some sort of escaping syntax? Perhaps the user wants to literally embed @something in a command-line; they should have a way to do so - perhaps \@something or @@something
- If a variable is undefined should it be an error or return the string 'undefined'? I'd go for the former