piotrmurach / tty-prompt

A beautiful and powerful interactive command line prompt
https://ttytoolkit.org
MIT License
1.47k stars 136 forks source link

this enables the collector to access the prompt object #195

Open doriantaylor opened 1 year ago

doriantaylor commented 1 year ago

Describe the change

Adds a read-only accessor to the @prompt member of TTY::Prompt::AnswerCollector

Why are we doing this?

To prevent ugly compromises in the code when we want to access the prompt without modifying the state of the answer collector.

Benefits

See above.

Drawbacks

It's literally one line of code that says attr_reader :prompt.

Requirements

  • [ ] Tests written & passing locally?
  • [ ] Code style checked?
  • [ ] Rebased with master branch?
  • [ ] Documentation updated?
  • [ ] Changelog updated?

It's literally one line of code.

piotrmurach commented 11 months ago

Hi Dorian,

Thanks for this PR.

To prevent ugly compromises in the code when we want to access the prompt without modifying the state of the answer collector.

Please provide an example when this is the case.

It's literally one line of code.

Let's take a step back for a moment. I maintain many Ruby projects and over the years established some helpful processes. The checklist is one of them. I have a responsibility to release quality software. This is a project that many people rely on and use. How would they find out about this addition, which is an extension of public API if no documentation is updated? More importantly, it would be good to have a test case that proves and cements the API so that nothing regresses in the future. So I'd encourage you to consider the checklist more carefully with an eye towards the longevity of the project and maintenance.