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

Review ConsolePrompt's method visibilities #1141

Open
mattirn opened this issue Dec 23, 2024 · 1 comment
Open

Review ConsolePrompt's method visibilities #1141

mattirn opened this issue Dec 23, 2024 · 1 comment
Milestone

Comments

@mattirn
Copy link
Collaborator

mattirn commented Dec 23, 2024

  1. ConsolePrompt do not implement AutoCloseable
  2. Create open() method that set terminal in raw mode (the last four statement of the constructor)
  3. enclose prompt methods
    1. public Map<String, PromptResultItemIF> prompt(List<AttributedString> header, List<PromptableElementIF> promptableElementList) and
    2. public Map<String, PromptResultItemIF> prompt(List<AttributedString> headerIn, Function<Map<String, PromptResultItemIF>, List<PromptableElementIF>> promptableElementLists)

code with "open() - close()" i.e.

    public Map<String, PromptResultItemIF> prompt(...) throws IOException {
        try {
            open();
            ....
            ....
            return resultMap;
        } finally {
            close();
        }
    }
  1. remove @Deprecated statements
  2. review ConsolePrompt's other methods visibilities
  3. fix examples
@quintesse
Copy link
Contributor

quintesse commented Dec 23, 2024

Ok, so if I understand this correctly this would roll back the change that made ConsolePrompt AutoCloseable?

If so another improvement might be introduce a subclass of ConsolePrompt that does implement AutoCloseable and that handles the open/close for you.

And perhaps (but I haven't thought it through a 100% yet) we would not even need a (public) open() necessarily, thereby maintaining full backward compatibility with older code (but we'd advise people to switch to the newer, improved, AutoCloseable version of ConsolePrompt)

WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants