Skip to content

Draft: New multi-select prompt

PopeRigby requested to merge poperigby/portmod:rust-prompt-multi into master

I've opened this early, because I wanted some feedback on a few things. Namely, using the multi-select prompt for selecting a profile in _cli/init.py and how to present the search results in the multi-select prompt.

_cli/init.py currently uses list_profiles to print a list of profiles, and it also returns the path of each profile. This will be problematic for the new prompt, as I don't want to display a list of paths (that would look ugly), but I need it to return the correct data so Portmod can select the correct profile. The best way to do this would probably be to create a new Profile class that has the necessary information for Portmod, and implement __str__() on it, like I did for RemoteRepo. Do you think that's a good idea?

My second question is about _cli/search.py. It has this huge function, display_search_results that handles printing out the search results in a nice way. Similar to list_profiles, this is problematic for the new prompt. Should I also do a custom class for each search result? I would then probably have to convert each search result to its atom, before passing it to configure.

Merge request reports