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

Custom menu #8

Open
simonovich opened this issue Jul 27, 2022 · 4 comments
Open

Custom menu #8

simonovich opened this issue Jul 27, 2022 · 4 comments

Comments

@simonovich
Copy link
Contributor

Okay, but what if I need to change the item marker?
https://github.com/php-school/cli-menu#item-markers

Or change menu width?

The wrapper does not provide access to menu objects.

@cinamo
Copy link
Member

cinamo commented Jul 27, 2022

You're right. I see two possible ways to go:

  • We could add another element to the select method in the SelectHelper for the user to provide their own CliMenuBuilder. That way, you can set all your menu options before the menu is rendered. Or,
  • We could have the doSelect fire an event before proceeding, that allows you to manipulate the CliMenuBuilder object before executing the build method.

The first option is a bit clunky, and still all the defaults like setExitButtonText would in theory override the provided object.
The latter method is probably the most flexible, but requires more boilerplate.

What do you think?

@simonovich
Copy link
Contributor Author

Maybe, add 2 optional parameters to method select:

  • object SelectableStyle (for change marker)
  • object MenuStyle (for change width, color, ...)

@ricohumme
Copy link
Collaborator

@simonovich does this change answer your question in any way? 95137b1

@simonovich
Copy link
Contributor Author

@ricohumme
Is the fix done according to the first solution to the problem from @cinamo ?
Looks good.

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

No branches or pull requests

3 participants