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

feat: Add progress step component #139

Merged
merged 12 commits into from
Jan 29, 2025
Merged

feat: Add progress step component #139

merged 12 commits into from
Jan 29, 2025

Conversation

pepicrft
Copy link
Contributor

@pepicrft pepicrft commented Dec 11, 2024

TL;DR

Added a new progress step component to display step-by-step execution with timing and status indicators.

What changed?

  • Added ProgressStep component that shows execution progress with optional spinner
  • Removed dependencies on Asynchrone and CombineX
  • Updated spinner implementation to use native Timer
  • Added success/error states with timing information
  • Added documentation and examples for the progress step component
  • Updated single and yes/no choice prompts to use consistent completion styling

How to test?

  1. Run the examples CLI with the progress-step command:
swift run examples-cli progress-step
  1. Observe the interactive spinner and progress updates
  2. Test both success and error scenarios
  3. Verify timing information is displayed
  4. Test in both interactive and non-interactive terminal modes

Why make this change?

To provide a consistent way to display step-by-step progress during command execution with visual feedback, timing information, and proper error handling. This improves the user experience by giving clear visibility into long-running operations.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@pepicrft pepicrft changed the title Add progress step feat: Add progress step component Dec 26, 2024
@pepicrft pepicrft requested a review from fortmarek December 26, 2024 15:59
@fortmarek
Copy link
Member

@pepicrft is this ready for review? Any reason for this being a draft?

@pepicrft pepicrft marked this pull request as ready for review December 30, 2024 17:05
Copy link
Member

@fortmarek fortmarek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks amazing 👏

.github/workflows/conventional-pr.yml Outdated Show resolved Hide resolved
Sources/Noora/Components/ProgressStep.swift Outdated Show resolved Hide resolved
Sources/Noora/Components/ProgressStep.swift Outdated Show resolved Hide resolved
Sources/Noora/Components/ProgressStep.swift Outdated Show resolved Hide resolved
Sources/Noora/Components/ProgressStep.swift Outdated Show resolved Hide resolved
docs/content/components/progress/step.md Outdated Show resolved Hide resolved
Sources/Noora/Components/ProgressStep.swift Outdated Show resolved Hide resolved
Sources/Noora/Components/ProgressStep.swift Outdated Show resolved Hide resolved
Sources/Noora/Components/ProgressStep.swift Outdated Show resolved Hide resolved
Comment on lines +19 to +24
message: String,
successMessage: String?,
errorMessage: String?,
showSpinner: Bool,
action: @escaping (@escaping (String) -> Void) async throws -> Void,
theme: Theme,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep the init for dependency injection and pass the rest of the variables through the run invocation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can update this one and the others to follow that, but I don't see much value. The public interface is through an instance of Noora, which then instantiates components and invokes the run. From the testing perspective, there isn't a notable benefit that I can think of.
If you feel strongly about it, I can go ahead with the change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with the current approach 👍

Copy link
Member

@fortmarek fortmarek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from this unaddressed comment, this is good to go from my side. Great work!

@@ -200,4 +200,25 @@ public struct Noora: Noorable {
theme: theme
).run()
}

public func progressStep(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to have been addressed

@pepicrft pepicrft merged commit 7d51fe8 into main Jan 29, 2025
7 of 8 checks passed
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