From 21c4280af9176832885e729d7430793574f93e87 Mon Sep 17 00:00:00 2001 From: miampf Date: Wed, 5 Jun 2024 13:33:45 +0200 Subject: [PATCH] docs: changed examples to working ones (#9) --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b0e33b2..e30ddaf 100644 --- a/README.md +++ b/README.md @@ -74,11 +74,14 @@ You can access the progress bars with `import glitzer/progress`. ### A simple progress bar ```gleam +import gleam/int +import gleam/iterator + import glitzer/progress -fn main() { +pub fn main() { let bar = - progress.new() + progress.new_bar() |> progress.with_length(100) |> progress.with_fill(progress.char_from_string("+")) |> progress.with_empty(progress.char_from_string("-")) @@ -101,13 +104,13 @@ the `fancy_slim_arrow_bar` template. ```gleam import glitzer/progress -fn main() { +pub fn main() { let bar = progress.fancy_slim_arrow_bar() do_stuff(bar, 0) } fn do_stuff(bar, count) { - case count <= 100 { + case count < 100 { True -> { let bar = progress.tick(bar) progress.print_bar(bar)