Repository navigation
Prompter overhaul #6255
Copy link
Copy link
Closed
Labels
tech-debtA chore that addresses technical debtA chore that addresses technical debt
Description
Activity
- addedtech-debtA chore that addresses technical debtA chore that addresses technical debt
on Sep 19, 2022 Including this discussion, thought perhaps it should be spun into its own issue:
mislav 6 days ago • @vilmibm Using the Prompter interface in the implementation has been a great success here, thank you! Using the PrompterMock in tests has also significantly improved over the legacy AskStubber, especially with the help of handy functions like prompter.IndexFor(), but I was wondering whether you had some thoughts on the solutions for the following: Asserting the order of prompts as the user experiences them. Right now prompt stubs are grouped by type, as a result of defining ConfirmFunc, InputFunc, and SelectFunc sequentially. Asserting that all defined prompts have been called. Here, I was using switch..case statements, but I'm not sure how would I keep track of which ones were activated and assert that there are no "dead" ones. None of these are hard requirements for me right now, but I was just wondering for the future. Thanks! vilmibm reacted with eyes emoji Member @vilmibm vilmibm 22 hours ago • I'm open to both of these things (and figured we'd want something like them) but haven't yet put time into designing solutions. Off the top of my head, maybe something like: prompter.Register(pm.SelectFunc, "What account do you want to log out of?", func(_, _ string, opts []string) (int, error) { return prompter.IndexFor(opts, "github.com") }) and a corresponding defer prompter.Verify(pm) It won't be super pretty but I believe this approach can solve both of your considerations. If you like this idea I can work on it. (I can also poke at a hack to get something like pm.Register to work instead of putting more stuff into the prompter package's top level) mislav reacted with heart emoji Member Author @mislav mislav 3 hours ago Thanks for weighing in. Right now, I feel no pressing need for these features, so we can explore this when it's needed in the future.
Metadata
Metadata
Assignees
Labels
tech-debtA chore that addresses technical debtA chore that addresses technical debt
This issue tracks our tech debt work around the new
Prompterinterface.There are 60 instances of either
SurveyAskorSurveyAskOne. They'll all need porting.For each change, tests will need to be updated to use
PrompterMockas well.gh runcommands #7302gh runcommands #7302gh runcommands #7302