Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

add prefix for enum type #481

Merged
merged 1 commit into from
Jan 11, 2022
Merged

Conversation

xwjdsh
Copy link
Contributor

@xwjdsh xwjdsh commented Nov 24, 2021

For multiple fields of the same enum type in a proto message, it's confusing not to prompt which field to enter...

After the change:
image

Copy link
Owner

@ktr0731 ktr0731 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, I had completely missed the existence of this Pull Request 🙇

fill/proto/interactive_filler.go Outdated Show resolved Hide resolved
@xwjdsh xwjdsh force-pushed the feat/add-enum-prefix branch from d20ebb1 to 4620275 Compare January 10, 2022 11:02
@xwjdsh
Copy link
Contributor Author

xwjdsh commented Jan 10, 2022

I misunderstood. I update the diff, is this the effect you want?

image

Copy link
Owner

@ktr0731 ktr0731 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick response!
I left a comment, so could you take it when you have time?

fill/proto/interactive_filler.go Outdated Show resolved Hide resolved
@xwjdsh xwjdsh force-pushed the feat/add-enum-prefix branch from 4620275 to 883102f Compare January 10, 2022 14:18
Copy link
Owner

@ktr0731 ktr0731 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Most changes are the thing I expected.
I left a nit comment about prefix string, could you take a look?

choices := make([]string, 0, len(e.GetValues()))
for _, v := range e.GetValues() {
choices = append(choices, v.GetName())
}

choice, err := r.selectChoices(e.GetFullyQualifiedName(), choices)
choice, err := r.selectChoices(prefix, choices)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the prompt has an unnecessary character :, it's better to trim it like ? choice (TYPE_ENUM) =>.
This can be pass a template through Templates.Label of promptui.Select (the implementation of the prompt).

FYI: the default template label is maybe here.

image

Copy link
Contributor Author

@xwjdsh xwjdsh Jan 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the diff. Wait a minute, maybe it's better to pass the template.

@codecov
Copy link

codecov bot commented Jan 11, 2022

Codecov Report

Merging #481 (0fc2236) into master (fbe7341) will decrease coverage by 0.08%.
The diff coverage is 37.50%.

@@            Coverage Diff             @@
##           master     #481      +/-   ##
==========================================
- Coverage   80.23%   80.15%   -0.09%     
==========================================
  Files          57       57              
  Lines        3840     3844       +4     
==========================================
  Hits         3081     3081              
- Misses        532      536       +4     
  Partials      227      227              

@xwjdsh xwjdsh force-pushed the feat/add-enum-prefix branch from 883102f to 0fc2236 Compare January 11, 2022 14:05
Copy link
Owner

@ktr0731 ktr0731 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Thanks for your contribution 🍻

@ktr0731 ktr0731 merged commit 9dc0d3f into ktr0731:master Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants