[gen-csv] Add interactive prompts to generate csv#2891
[gen-csv] Add interactive prompts to generate csv#2891varshaprasad96 merged 1 commit intooperator-framework:masterfrom
Conversation
|
Would be helpful to have some reviews. Yet to write unit tests. |
bf6fc8c to
0ada52e
Compare
0ada52e to
d9b07f3
Compare
|
Added tests. |
d9b07f3 to
e28a545
Compare
estroz
left a comment
There was a problem hiding this comment.
I'd like to see a generalized interactive prompt library somewhere like internal/util/projutil so we can reuse it easily and not have to encode Generator-specific logic in cmd/operator-sdk.
e28a545 to
1cffae5
Compare
|
Refactored the code to address the comments. |
1cffae5 to
2493ef8
Compare
2493ef8 to
5207bf3
Compare
|
I tested this and it seems to work, I'd say it needs a website docs update and a changelog fragment file? |
5207bf3 to
185be51
Compare
|
@jmccormick2001 I have added the changelog fragment file to this PR. Will create a follow-up PR to update the docs after this is merged. |
b499a73 to
0b374d3
Compare
|
@estroz @camilamacedo86 Addressed review comments. |
0b374d3 to
a37b863
Compare
cd0df7c to
8629bf4
Compare
joelanford
left a comment
There was a problem hiding this comment.
Looks great! Mostly non-blocking nits.
I think spacing the prompts out would be my only blocker if there's agreement on that suggestion.
Another non-blocking follow-up to this could be to add support for default values. That way if someone has an existing CSV and they ask for --interactive, we can do something like this:
Display name for operator [Example Database Operator]:
>And empty input would result in the default being used.
Lastly, was there any consideration for using an existing interactive prompt library? I'm not suggesting that we make that change here, but curious if we may want to think about that in the future if we need more features?
8629bf4 to
688ceb8
Compare
|
New changes are detected. LGTM label has been removed. |
|
@joelanford I completely agree with the formatting, and have modified the PR so that the prompts have spaces in between. There are a few prompt libraries like go-prompt and prompt-ui. These are shell libraries which have more advanced features like auto-complete/suggestions or selections . And for creating simple prompts as we have done, they follow a similar approach as here. To make it more flexible (like getting strings, and performing any further operations on it), I wrote these functions to do the same. But we could definitely modify the available libraries in future to have more powerful features and modifications in the prompts. I'll create a follow up PR for providing the default values to the user when we have base CSV. |
4be7b11 to
7703efa
Compare
joelanford
left a comment
There was a problem hiding this comment.
One more nit, but otherwise LGTM!
GREAT job on this! Totally digging the design of the CLI prompt library and keeping it separate from the CSV generation code that uses it.
This PR introduces the feature to provide interactive prompts to the user to obtain csv metadata.
7703efa to
5366a39
Compare
This PR introduces the feature to provide interactive prompts
to the user to obtain csv metadata.
Description of the change:
Add interactive prompts while generating csv.