fix: listCommands parser not detecting commands and actions#2
Open
restarter wants to merge 1 commit intoArtMin96:mainfrom
Open
fix: listCommands parser not detecting commands and actions#2restarter wants to merge 1 commit intoArtMin96:mainfrom
restarter wants to merge 1 commit intoArtMin96:mainfrom
Conversation
The parser was using trimmed line to check for indentation, but trim()
removes leading spaces. This caused:
1. Command detection failed because trimmed.includes(' ') was true
for command lines with aligned descriptions (multiple spaces)
2. Action detection failed because trimmed.startsWith(' ') was
always false after trim() removed leading spaces
Fix: Use original line for indentation checks, trimmed for content parsing.
Author
|
Note: I kept the 8-space check ( |
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.
Problem
The
yii_list_commandstool returns empty results because the parser logic has bugs:Command detection - Line 96 checks
!trimmed.includes(' ')but command lines like:contain multiple spaces for alignment, so this condition filters them out.
Action detection - Line 109 checks
trimmed.startsWith(' ')but aftertrim()there are no leading spaces, so action lines are never detected.Solution
!trimmed.includes(' ')check for commands - they're identified by starting with-lineinstead oftrimmedfor indentation checkstrimmedonly for content parsing after indentation is verifiedTesting
Before fix:
After fix: