Add inline flag to rez-interpret#2100
Conversation
Signed-off-by: hundreds-of-bears-dev <hundredsofbears@proton.me>
cf47bf3 to
d8c7c2c
Compare
Signed-off-by: hundreds-of-bears-dev <hundredsofbears@proton.me>
c1b586a to
cde8659
Compare
Signed-off-by: hundreds-of-bears-dev <hundredsofbears@proton.me>
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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/--cmdCLI 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.
| if opts.cmd: | ||
| code = opts.FILE | ||
| else: | ||
| with open(opts.FILE) as f: | ||
| code = f.read() |
There was a problem hiding this comment.
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?
| parser.add_argument( | ||
| "-c", "--cmd", action="store_true", | ||
| help="interpret FILE as a command string") |
|
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! |
Currently,
rez-interpretonly accepts a valid file path as its argument.This change adds the
-cflag which allows the user to pass programs as strings from the command line.