You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(cli): allow overriding DGL var values - #2488
Add repeatable --dgl-arg NAME=VALUE options for overriding variables declared in a DGL script's var block.
Apply the overrides in memory before both --check and execution. Reject unknown or duplicate variable names and values whose top-level type does not match the default.
Document CLI quoting and examples for strings, lists, and dictionaries.
If this PR adds or changes model support, I have added or updated its usage guide and relevant model index/README entries following the model documentation requirements.
Summary by CodeRabbit
New Features
Added repeatable --dgl-arg NAME=VALUE options to override script variables when running a script or using --check.
Overrides support strings and typed DGL literals, including lists and dictionaries. Invalid values, unknown variable names, and duplicate names produce errors.
Documentation
Documented the new option, its accepted values, and its behavior with script checking.
No actionable comments were generated in the recent review.
Walkthrough
The CLI now accepts repeated --dgl-arg NAME=VALUE options. It validates and converts values, then applies matching overrides to the first DGL var block before checking or executing the script.
Changes: DGL Script Argument Overrides
Layer / File(s)
Summary
CLI argument contract and validation examples/cli/dgl.h, examples/cli/dgl.cpp
The CLI stores overrides in a string map, accepts repeated --dgl-arg options, rejects malformed or duplicate names, and requires a script path when overrides are present.
Literal scanning and type conversion examples/cli/dgl_args.cpp
The scanner identifies strings, numbers, booleans, and nested containers. String arguments are JSON-quoted; other arguments must be one literal matching the existing value’s type.
Source replacement and script processing examples/cli/dgl_args.cpp, examples/cli/dgl.cpp, examples/cli/CMakeLists.txt, examples/cli/README.md
apply_dgl_args replaces matching values in the first var block. The CLI applies overrides before checking or executing the script. The build includes the new source file, and the README documents the option.
sequenceDiagram
participant CLI parser
participant run
participant apply_dgl_args
participant DGL script processing
CLI parser->>run: DGLModeParams with script_args
run->>apply_dgl_args: source and script_args
apply_dgl_args-->>run: source with replacements
run->>DGL script processing: modified source for checking or execution
Loading
Merge Risk: Minimal · up to ddd7a
This adds a new opt-in --dgl-arg NAME=VALUE option to the CLI. It only affects invocations that use it, and unknown names, duplicate names and type mismatches are rejected with errors. No actionable merge-blocking risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "feat(cli): allow overriding DGL var values" matches the main change. The PR adds repeatable --dgl-arg NAME=VALUE options that override variables in a DGL script's var block. The changeset i…
Description check
The description follows the template. It includes Summary, Related Issue / Discussion, Additional Information, and Checklist sections. The Summary explains the new --dgl-arg option, in-memory applicat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "feat(cli): allow overriding DGL var values" matches the main change. The PR adds repeatable --dgl-arg NAME=VALUE options that override variables in a DGL script's var block. The changeset includes the new apply_dgl_args function, the DGLModeParams script_args field, and the README documentation for the option.
Full details: Description check
Explanation
The description follows the template. It includes Summary, Related Issue / Discussion, Additional Information, and Checklist sections. The Summary explains the new --dgl-arg option, in-memory application before --check and execution, validation rules, and the CLI quoting documentation. Related Issue and Additional Information are marked N/A, which is acceptable. Both checklist items are checked.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 4393d4e9-3577-437f-98b9-a208b22c5125
Commits
Reviewing files that changed from the base of the PR and between f93d45b and ddd7a1f.
Files selected for processing: 5
examples/cli/CMakeLists.txt
examples/cli/README.md
examples/cli/dgl.cpp
examples/cli/dgl.h
examples/cli/dgl_args.cpp
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--dgl-arg NAME=VALUEoptions for overriding variables declared in a DGL script'svarblock.--checkand execution. Reject unknown or duplicate variable names and values whose top-level type does not match the default.Related Issue / Discussion
N/A
Additional Information
N/A
Checklist
Summary by CodeRabbit
--dgl-arg NAME=VALUEoptions to override script variables when running a script or using--check.