Skip to content

Conversation

m-horky
Copy link
Contributor

@m-horky m-horky commented Sep 5, 2025

  • Card ID: CCT-1587

This patch removes big part of terminal and output-related logic into its own package. This will allow us to decouple CLI and business logic from each other later.

This patch deviates from the original implementation by separating the no-color preference from rich experience like interactive input and spinners.

@m-horky m-horky marked this pull request as ready for review September 5, 2025 11:48
@jirihnidek
Copy link
Contributor

@m-horky This PR has conflicts with main branch. Please resolve these conflicts.

* Card ID: CCT-1587

This patch removes big part of terminal and output-related logic
into its own package. This will allow us to decouple CLI and business
logic from each other later.
@m-horky m-horky force-pushed the mhorky/refactor-interactive branch from 72cae87 to 6c75484 Compare September 5, 2025 13:14
@m-horky
Copy link
Contributor Author

m-horky commented Sep 5, 2025

I'm assuming we'll get another conflict after #269 is merged. I'll deal with it when it happens.

* Card ID: CCT-1587

- Move 'interactivePrintf' to 'ui.Printf'
- Move 'showProgress' to 'ui.Spinner'

By moving these methods, we decouple presentation from UI logic a bit
better. Different names have been picked to better describe their
functions.
@m-horky
Copy link
Contributor Author

m-horky commented Sep 5, 2025

Questions for the review to consider:

  • I like the separation in ui/ (where we have struct.go for structure definitions, with methods in other files using them). Do we want to make it a preferred code structure long-term?
  • Are the ui.IsInteractive, ui.IsOutputMachineReadable, ui.IsOutputRich named in such a way it is clear what they represent?
  • Are the ui.Printf and ui.Spinner method names descriptive enough?
  • I've reordered the arguments for Spinner: first goes the method (as the most important), then the prefix, then suffix/message. Any arguments against?
  • You need to read the docs to configure output (see the arguments to ui.ConfigureOutput). Is there a prettier way?

@m-horky m-horky force-pushed the mhorky/refactor-interactive branch from 6c75484 to 872bf4e Compare September 5, 2025 13:25
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

Successfully merging this pull request may close these issues.

2 participants