feat: add path field to ParsedCommand::Read variant #5275
Merged
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.
ParsedCommand::Read
has aname
field that attempts to identify the name of the file being read, but the file may not be in thecwd
in which the command is invoked as demonstrated by this existing unit test:codex/codex-rs/core/src/parse_command.rs
Lines 250 to 260 in 0139f67
As you can see,
tui/Cargo.toml
is the relative path to the file being read.This PR introduces a new
path: PathBuf
field toParsedCommand::Read
that attempts to capture this information. When possible, this is an absolute path, though when relative, it should be resolved against thecwd
that will be used to run the command to derive the absolute path.This should make it easier for clients to provide UI for a "read file" event that corresponds to the command execution.