Skip to content

feat(cli): allow overriding DGL var values - #2488

Merged
leejet merged 1 commit into
masterfrom
feat/dgl-cli-args
Dec 2, 2026
Merged

leejet merged 1 commit into
masterfrom
feat/dgl-cli-args

Conversation

@leejet

@leejet leejet commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • 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.

Related Issue / Discussion

N/A

Additional Information

N/A

Checklist

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.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Explain Change →

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.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • 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.

@leejet
leejet merged commit d3400ce into master Dec 2, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant