Skip to content

Add inline flag to rez-interpret#2100

Open
hundreds-of-bears-dev wants to merge 4 commits into
AcademySoftwareFoundation:mainfrom
hundreds-of-bears-dev:main
Open

Add inline flag to rez-interpret#2100
hundreds-of-bears-dev wants to merge 4 commits into
AcademySoftwareFoundation:mainfrom
hundreds-of-bears-dev:main

Conversation

@hundreds-of-bears-dev
Copy link
Copy Markdown

Currently, rez-interpret only accepts a valid file path as its argument.

This change adds the -c flag which allows the user to pass programs as strings from the command line.

@hundreds-of-bears-dev hundreds-of-bears-dev requested a review from a team as a code owner May 11, 2026 01:34
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 11, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

Signed-off-by: hundreds-of-bears-dev <hundredsofbears@proton.me>
Signed-off-by: hundreds-of-bears-dev <hundredsofbears@proton.me>
Signed-off-by: hundreds-of-bears-dev <hundredsofbears@proton.me>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

❌ Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.64%. Comparing base (d415b96) to head (117b982).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/rez/cli/interpret.py 20.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2100      +/-   ##
==========================================
- Coverage   60.65%   60.64%   -0.01%     
==========================================
  Files         164      164              
  Lines       20584    20587       +3     
  Branches     3579     3580       +1     
==========================================
+ Hits        12485    12486       +1     
- Misses       7224     7226       +2     
  Partials      875      875              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for interpreting inline Rex code strings via a new -c flag in rez-interpret, so users can run short programs directly from the command line without creating a file.

Changes:

  • Added -c/--cmd CLI flag to switch the positional argument from “file path” mode to “inline code string” mode.
  • Updated command execution logic to read code from either the positional argument (inline) or from file contents (default).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/rez/cli/interpret.py
Comment on lines +51 to +55
if opts.cmd:
code = opts.FILE
else:
with open(opts.FILE) as f:
code = f.read()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if I've been using and maintaining rez for years, I don't remember ever using that interpret command. Copilot's command seem to make sense. Can you verify that the filename is handled correctly and doesn't cause any weight output please?

Comment thread src/rez/cli/interpret.py
Comment on lines +17 to +19
parser.add_argument(
"-c", "--cmd", action="store_true",
help="interpret FILE as a command string")
Comment thread src/rez/cli/interpret.py
@JeanChristopheMorinPerso
Copy link
Copy Markdown
Member

JeanChristopheMorinPerso commented May 11, 2026

Hi @hundreds-of-bears-dev, thanks for contributing this change. I like the idea. Can you look at copilot comments please? Note that I reviewed the comments and marked one as resolved because I don't think you need to do it (we need more tests, but we aren't yet there for our commands). The two others seem valid and I think need to be addressed.

Thanks!

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.

3 participants