-
Notifications
You must be signed in to change notification settings - Fork 127
App-14418: add more direction for module and model name #5629
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
Conversation
cli/module_generate.go
Outdated
| huh.NewInput(). | ||
| Title("Set a module name:"). | ||
| Description("The module name can contain only alphanumeric characters, dashes, and underscores."). | ||
| Description("This can be the name of the piece of hardware, the challenge you are trying to\n"+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
took wording from ticket but lmk if you want to change the verbage or wording!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls add a new line before The module name can contain only...
| Description("This is the name of the new resource model that your module will provide.\n"+ | ||
| "The model name can contain only alphanumeric characters, dashes, and underscores."). | ||
| Placeholder("my-model"). | ||
| PlaceholderFunc(func() string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the ticket calls to pre-populate text rather than have the background gray placeholder, but the huh package doesn't have the ValueFunc() implemented yet to dynamically change it
I tried:
- change the module.ModelName value with a validate() function, but its set when the form is created and doesn't change
- change the module.ModelName value by setting Value to a func() that returns resource type, but its set when the form is created and sets it to the first resource of
arm - change the module.ModelName with PlaceholderFunc, but it only changes the Placeholder (can't put an extra function in it to edit ModelName)
- create an Accessor function where you can create your own get() and set() function, but get() runs at form creation time so set to first resource of 'arm'
Didn't think it was worth it to split the form into two (ask resource name first and then prepopulate on another loaded form), switch packages, or make an open source contribution to huh package
| PlaceholderFunc(func() string { | ||
| return modelName(module) | ||
| }, &module.Resource). | ||
| SuggestionsFunc(func() []string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the only suggestion that makes sense to make is the model name we recommend
cli/module_generate.go
Outdated
| huh.NewInput(). | ||
| Title("Set a module name:"). | ||
| Description("The module name can contain only alphanumeric characters, dashes, and underscores."). | ||
| Description("This can be the name of the piece of hardware, the challenge you are trying to\n"+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls add a new line before The module name can contain only...
Demo:
Screen.Recording.2026-01-06.at.2.50.52.PM.mov