Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feature: case-insensitive "digger" in comment ops #1759

Open
dannysauer opened this issue Oct 10, 2024 · 1 comment
Open

feature: case-insensitive "digger" in comment ops #1759

dannysauer opened this issue Oct 10, 2024 · 1 comment

Comments

@dannysauer
Copy link
Contributor

I wasn't paying attention while working on mobile, and my phone keyboard defaults to upper-casing the first letter typed in a field like it's a sentence, which isn't valid. It's a trivial thing, but perhaps the comment prefix could be compared with case-insensitivity. That may be as simple as updating this line:

if !strings.HasPrefix(*payload.Comment.Body, "digger") {

@dannysauer
Copy link
Contributor Author

Looks like the command parser is already forcing to lowercase.

func GetCommandFromComment(comment string) (*DiggerCommand, error) {
supportedCommands := map[string]DiggerCommand{
"digger noop": DiggerCommandNoop,
"digger plan": DiggerCommandPlan,
"digger apply": DiggerCommandApply,
"digger unlock": DiggerCommandUnlock,
"digger lock": DiggerCommandLock,
}
diggerCommand := strings.ToLower(comment)
diggerCommand = strings.TrimSpace(diggerCommand)
for command, value := range supportedCommands {
if strings.HasPrefix(diggerCommand, command) {
return &value, nil
}
}
return nil, fmt.Errorf("Unrecognised command: %v", comment)
}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant