Open
Conversation
13 tasks
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.
PR Type
What kind of change does this PR introduce?
Summary
Adds support for custom command syntax auto generation based on command name and parameter definition. If
syntaxparameter is not provided, the syntax will be generated. The value syntax for each parameter is either derived from the validation type or can be defined by thesyntaxattribute of the parameter. It's also possible to omit a parameter from the syntax using thesyntaxGenerationattribute.Changes
Added the attributes
syntaxandsyntaxGenerationto the attribute object, and made thesyntaxattribute on the custom command object optional. Additionally removed the length limit from custom commandssyntaxattribute, because it might be to low for many use-cases.Implemented automatic syntax generation and also formatting with line breaks on a soft limit of 150 characters by line in searchbnf.conf.
This is another update after #1977 and #1979.
User experience
Now the user get's automatically a syntax which includes all command parameters and basic value definition. After this change, the developer must only define parameters, where the automatic generated syntax is not sufficient. It is still possible to override the automatic generation by specifying the
syntaxattribute, so nothing changes for existing projects.Gerneral notes for syntax in searchbnf.conf:
<bool>,<int>or<string>.(high|medium|low), as it shows only the value options, not the parameter.The current implementation is based on my experience, which syntax definitions works best for the given scenarios. I'm still not sure if option lists are a good solution, but they are used in many splunk core implementations, so the generator are also using them.
Checklist
If an item doesn't apply to your changes, leave it unchecked.
Review
Tests
See the testing doc.
Demo/meeting:
Reviewers are encouraged to request meetings or demos if any part of the change is unclear