Skip to content

Commit

Permalink
docs: changed examples to working ones (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
miampf authored Jun 5, 2024
1 parent 0072e02 commit 21c4280
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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("-"))
Expand All @@ -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)
Expand Down

0 comments on commit 21c4280

Please sign in to comment.