-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Currently, to compose multiple configuration files or override specific state variables from a base configuration, the user must provide all files as command-line arguments in a specific order.
For example, if I want semeru25.yaml to take priority over (and extend) semeru.yaml, I currently have to execute the command like this:
jbang qDup@hyperfoil -b /tmp semeru25.yaml semeru.yamlThis approach has a few downsides:
- Command Complexity: As configurations grow, the CLI command becomes verbose and prone to ordering errors.
- Implicit Dependencies: The entry point file (
semeru25.yaml) does not explicitly state that it relies onsemeru.yaml. A user must "just know" to include the base file in the CLI arguments for the script to function correctly.
Describe the solution you'd like
I would like to introduce a uses: keyword (or similar, like import or include) within the YAML definition itself. This allows a specific YAML file to explicitly define its base dependencies.
When qDup processes a file with uses:, it should load the referenced file(s) first, and then overlay the current file's configuration on top of it. This ensures the current file maintains priority (overrides) for variables and state.
Proposed Syntax Example
File: semeru.yaml (The Base)
scripts:
my-script:
- sh: echo "I am the base script"
STATE:
VERSION: "1.0"
File: semeru25.yaml (The Implementation)
# Proposed new keyword
uses: semeru.yaml
# This file's definitions should take priority/merge with the used file
STATE:
VERSION: "2.5"
Expected Behavior
Running the command with just the single entry file:
jbang qDup@hyperfoil -b /tmp semeru25.yaml
should automatically detect the uses directive, load semeru.yaml in the background, and result in a merged configuration where VERSION is 2.5.
Additional Context
The uses keyword should support a list of files to allow for multiple layers of composition.
Precedence Rule:
The processing order should follow the list sequence, where the last file in the uses list takes precedence over the first. The current file (the one defining uses) takes priority over everything in the list.
Example:
uses:
- base.yaml
- middle.yaml
In this scenario:
base.yamlis loaded.middle.yamlis loaded and overridesbase.yaml.- The current file is loaded and overrides
middle.yaml.
This feature moves dependency management from "execution time" (CLI args) to "definition time" (YAML), making scripts more self-contained, portable, and easier to share.