Skip to content

Commit

Permalink
added example comment
Browse files Browse the repository at this point in the history
  • Loading branch information
miampf committed Jun 4, 2024
1 parent 0e62c65 commit f7fef15
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/glitzer/progress.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,31 @@ pub fn finish(bar bar: ProgressStyle) -> ProgressStyle {
}

/// Print the progress bar to stderr.
///
/// <details>
/// <summary>Example:<summary>
///
/// ```gleam
/// import glitzer/progress
///
/// fn example() {
/// let bar = progress.default_bar()
///
/// run_example(bar, 0)
/// }
///
/// fn run_example(bar, count) {
/// case count < 100 {
/// True -> {
/// let bar = progress.tick(bar)
/// // do some awesome stuff :3
/// progress.print_bar(bar)
/// run_example(bar, count + 1)
/// }
/// False -> Nil
/// }
/// }
/// ```
pub fn print_bar(bar bar: ProgressStyle) {
let fill =
build_progress_fill(string_builder.new(), bar, bar.state.progress, 0)
Expand Down

0 comments on commit f7fef15

Please sign in to comment.