Merged
Conversation
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixed the original error when only a file path is provided without a dot pattern:
Added a check in the run function to detect when lookup_chain is None
If the file exists, show a helpful error message instead of crashing
Added handling for the opposite case when only a dot path is provided without a file:
Added a function is_likely_dot_path() to detect when a single argument looks like a dot path
If it's a dot path, show a helpful error message indicating that a file path is required
Added color to the error messages using ANSI escape codes:
Created a red() function to format text in red
Applied red color to the key parts of the error messages that indicate what's missing:
"Dot" and "Which" in the message when a dot pattern is missing
"" in the example command when a dot pattern is missing
"File" and "Which" in the message when a file path is missing
"" in the example command when a file path is missing
Now when users run the command with incomplete arguments, they'll see clear, colorful error messages:
When only a file is provided (e.g., dotcat test.json):
Dot path required. Which value do you want me to look up in test.json?
$dotcat test.json
(with "Dot", "Which", and "" in red)
When only a dot path is provided (e.g., dotcat python.editor.tabSize):
File path required. Which file contains the value at python.editor.tabSize?
$dotcat python.editor.tabSize
(with "File", "Which", and "" in red)
These improvements make the tool more user-friendly by providing clear guidance when arguments are missing, rather than crashing with a confusing error or showing a generic usage message.