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 a with_transform function to spinners #20

Merged
merged 7 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ pub fn main() {

// update the text
spinner.with_left_text(s, "Now imma spin some more :] ")
|> spinner.with_frame_transform(fn(s) {"<" <> s <> ">"})

spinner.finish(s) // clear the line and print the finish text
}
Expand Down
41 changes: 24 additions & 17 deletions birdie_snapshots/test_spinner_bar_left_right_spinner.accepted
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,30 @@ file: ./test/glitzer_test.gleam
test_name: spinner_bar_left_right_spinner_test
---
SpinnerStyle(
Frames(#(
"▏",
"▎",
"▍",
"▌",
"▋",
"▊",
"▉",
"█",
"▉",
"▊",
"▋",
"▌",
"▍",
"▎",
)),
100,
"",
State("", "", 0, False, None),
State(
Frames(#(
"▏",
"▎",
"▍",
"▌",
"▋",
"▊",
"▉",
"█",
"▉",
"▊",
"▋",
"▌",
"▍",
"▎",
)),
//fn(a) { ... },
"",
"",
0,
False,
None,
),
)
41 changes: 24 additions & 17 deletions birdie_snapshots/test_spinner_bar_up_down_spinner.accepted
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,30 @@ file: ./test/glitzer_test.gleam
test_name: spinner_bar_up_down_spinner_test
---
SpinnerStyle(
Frames(#(
"▁",
"▂",
"▃",
"▄",
"▅",
"▆",
"▇",
"█",
"▇",
"▆",
"▅",
"▄",
"▃",
"▂",
)),
100,
"",
State("", "", 0, False, None),
State(
Frames(#(
"▁",
"▂",
"▃",
"▄",
"▅",
"▆",
"▇",
"█",
"▇",
"▆",
"▅",
"▄",
"▃",
"▂",
)),
//fn(a) { ... },
"",
"",
0,
False,
None,
),
)
11 changes: 9 additions & 2 deletions birdie_snapshots/test_spinner_default_spinner.accepted
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ file: ./test/glitzer_test.gleam
test_name: spinner_default_spinner_test
---
SpinnerStyle(
Frames(#("|", "/", "-", "\")),
100,
"",
State("", "", 0, False, None),
State(
Frames(#("|", "/", "-", "\")),
//fn(a) { ... },
"",
"",
0,
False,
None,
),
)
35 changes: 21 additions & 14 deletions birdie_snapshots/test_spinner_prideful_spinner.accepted
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,27 @@ file: ./test/glitzer_test.gleam
test_name: spinner_prideful_spinner_test
---
SpinnerStyle(
Frames(#(
"░",
"▒",
"▓",
"█",
"▓",
"▒",
"░",
"▒",
"▓",
"█",
"▓",
)),
200,
"",
State("", "", 0, False, None),
State(
Frames(#(
"░",
"▒",
"▓",
"█",
"▓",
"▒",
"░",
"▒",
"▓",
"█",
"▓",
)),
//fn(a) { ... },
"",
"",
0,
False,
None,
),
)
18 changes: 16 additions & 2 deletions birdie_snapshots/test_spinner_pulsating_spinner.accepted
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,22 @@ file: ./test/glitzer_test.gleam
test_name: spinner_pulsating_spinner_test
---
SpinnerStyle(
Frames(#("░", "▒", "▓", "█", "▓", "▒")),
100,
"",
State("", "", 0, False, None),
State(
Frames(#(
"░",
"▒",
"▓",
"█",
"▓",
"▒",
)),
//fn(a) { ... },
"",
"",
0,
False,
None,
),
)
29 changes: 18 additions & 11 deletions birdie_snapshots/test_spinner_spinning_spinner.accepted
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,24 @@ file: ./test/glitzer_test.gleam
test_name: spinner_spinning_spinner_test
---
SpinnerStyle(
Frames(#(
"⣾",
"⣷",
"⣯",
"⣟",
"⡿",
"⢿",
"⣻",
"⣽",
)),
100,
"",
State("", "", 0, False, None),
State(
Frames(#(
"⣾",
"⣷",
"⣯",
"⣟",
"⡿",
"⢿",
"⣻",
"⣽",
)),
//fn(a) { ... },
"",
"",
0,
False,
None,
),
)
11 changes: 9 additions & 2 deletions birdie_snapshots/test_spinner_tick.accepted
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ file: ./test/glitzer_test.gleam
test_name: spinner_tick_test
---
SpinnerStyle(
Frames(#("|", "/", "-", "\")),
100,
"",
State("", "", 1, False, None),
State(
Frames(#("|", "/", "-", "\")),
//fn(a) { ... },
"",
"",
1,
False,
None,
),
)
11 changes: 9 additions & 2 deletions birdie_snapshots/test_spinner_tick_by.accepted
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ file: ./test/glitzer_test.gleam
test_name: spinner_tick_by_test
---
SpinnerStyle(
Frames(#("|", "/", "-", "\")),
100,
"",
State("", "", 10, False, None),
State(
Frames(#("|", "/", "-", "\")),
//fn(a) { ... },
"",
"",
10,
False,
None,
),
)
11 changes: 9 additions & 2 deletions birdie_snapshots/test_spinner_with_finish_text.accepted
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ file: ./test/glitzer_test.gleam
test_name: spinner_with_finish_text_test
---
SpinnerStyle(
Frames(#("|", "/", "-", "\")),
100,
"asdf",
State("", "", 0, False, None),
State(
Frames(#("|", "/", "-", "\")),
//fn(a) { ... },
"",
"",
0,
False,
None,
),
)
19 changes: 19 additions & 0 deletions birdie_snapshots/test_spinner_with_frame_transform.accepted
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
version: 1.1.6
title: Test spinner.with_frame_transform
file: ./test/glitzer_test.gleam
test_name: spinner_with_frame_transform_test
---
SpinnerStyle(
100,
"",
State(
Frames(#("|", "/", "-", "\")),
//fn(a) { ... },
"",
"",
0,
False,
None,
),
)
19 changes: 19 additions & 0 deletions birdie_snapshots/test_spinner_with_frames.accepted
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
version: 1.1.6
title: Test spinner.with_frames
file: ./test/glitzer_test.gleam
test_name: spinner_with_frames_test
---
SpinnerStyle(
100,
"",
State(
Frames(#("a", "s", "d", "f")),
//fn(a) { ... },
"",
"",
0,
False,
None,
),
)
11 changes: 9 additions & 2 deletions birdie_snapshots/test_spinner_with_left_text.accepted
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ file: ./test/glitzer_test.gleam
test_name: spinner_with_left_text_test
---
SpinnerStyle(
Frames(#("|", "/", "-", "\")),
100,
"",
State("asdf", "", 0, False, None),
State(
Frames(#("|", "/", "-", "\")),
//fn(a) { ... },
"asdf",
"",
0,
False,
None,
),
)
11 changes: 9 additions & 2 deletions birdie_snapshots/test_spinner_with_right_text.accepted
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ file: ./test/glitzer_test.gleam
test_name: spinner_with_right_text_test
---
SpinnerStyle(
Frames(#("|", "/", "-", "\")),
100,
"",
State("", "asdf", 0, False, None),
State(
Frames(#("|", "/", "-", "\")),
//fn(a) { ... },
"",
"asdf",
0,
False,
None,
),
)
11 changes: 9 additions & 2 deletions birdie_snapshots/test_spinner_with_tick_rate.accepted
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ file: ./test/glitzer_test.gleam
test_name: spinner_with_tick_rate_test
---
SpinnerStyle(
Frames(#("|", "/", "-", "\")),
10,
"",
State("", "", 0, False, None),
State(
Frames(#("|", "/", "-", "\")),
//fn(a) { ... },
"",
"",
0,
False,
None,
),
)
Loading