Repository navigation
Conversation
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.
What type of PR is this?
What problem(s) does this PR solve?
Issue(s) number:
Fixes #263
Related: #162, #236
Description:
words[0].words[1].isConsoleCmd().loop()display errors and continue the interactive session.:params.How to reproduce:
Start NebulaGraph Console in interactive mode using a build that does not contain this fix.
Execute each command below separately. Each command should be tested in a fresh Console process because the original panic terminates the current process.
1. Empty local command
Previously, this caused:
The parser accesses
words[0]even though the command contains no command name.2. Local commands with missing required arguments
Run each of the following commands separately:
Previously, each command caused:
The corresponding command handlers access
words[1]without first checking whether the required argument exists.Expected behavior:
:displays a clear empty-command error instead of panicking.How to verify:
1. Run the targeted unit test for all missing-argument cases:
This test covers all eight inputs:
:,:sleep,:play,:repeat,:csv,:dot,:profile, and:explain.2. Run all local-command unit tests:
This also verifies:
:repeat 3is parsed successfully with its argument.:paramscontinues to work without an argument.3. Run all repository tests:
go test -count=1 ./...4. Verify interactively:
In a Console build containing this fix, enter each of the eight reproduction commands separately. Verify that Console displays an error and continues accepting input instead of exiting.
Then verify normal behavior with:
The first two commands should retain their existing behavior, and the unknown command should continue to be handled by the existing unknown-command path.