-
Notifications
You must be signed in to change notification settings - Fork 46
Developer Guides
Abhimanyu Sharma edited this page Dec 24, 2021
·
3 revisions
- Clone the repo.
- In the
processorsfolder create a new go file. - Here is the structure that you need to follow.
type ProcessorName struct{}
func (p ProcessorName) Name() string {
// This will be name of your processor.
// Will show up in UI and also will be use by cli.
// sttr your-command
return "provide-cli-name-here"
}
func (p ProcessorName) Alias() []string {
// List of all the cli alias will go here.
// It can be multiple
// sttr your-command-alias
return []string{"Provide UI title here"}
}
func (p ProcessorName) Transform(data []byte, _ ...Flag) (string, error) {
// This is where all your main logic will go
// Do all the processing here
// Make sure to return string and error
return "", nil
}
func (p ProcessorName) Flags() []Flag {
// Provide list of flags if your command needs those.
return nil
}
func (p ProcessorName) Title() string {
// This title show up in UI
return "Provide UI title here"
}
func (p ProcessorName) Description() string {
// This description need to short
// A good fit will be less than 50 words
// It will show up in UI
return "Provide UI title here"
}
func (p ProcessorName) FilterValue() string {
// You can keep the same.
return p.Title()
}- After this run these two commands.
go generate
go build-
You will get a binary with the name
sttrin the base directory of the project. -
Please make sure to write the test cases for your processor.