Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions Sources/TerminalProgress/ProgressBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,6 @@ public final class ProgressBar: Sendable {
}
}

private func printFullDescription() {
let (description, subDescription) = state.withLock { ($0.description, $0.subDescription) }

if subDescription != "" {
standardError.write("\(description) \(subDescription)")
} else {
standardError.write(description)
}
}

/// Updates the description of the progress bar and increments the tasks by one.
/// - Parameter description: The description of the action being performed.
public func set(description: String) {
Expand All @@ -84,9 +74,6 @@ public final class ProgressBar: Sendable {
$0.subDescription = ""
$0.tasks += 1
}
if config.disableProgressUpdates {
printFullDescription()
}
}

/// Updates the additional description of the progress bar.
Expand All @@ -95,16 +82,9 @@ public final class ProgressBar: Sendable {
resetCurrentTask()

state.withLock { $0.subDescription = subDescription }
if config.disableProgressUpdates {
printFullDescription()
}
}

private func start(intervalSeconds: TimeInterval) async {
if config.disableProgressUpdates && !state.withLock({ $0.description.isEmpty }) {
printFullDescription()
}

while !state.withLock({ $0.finished }) {
let intervalNanoseconds = UInt64(intervalSeconds * 1_000_000_000)
render()
Expand Down