@@ -65,21 +65,22 @@ The spinner function creates a console-based spinner animation, offering a visua
6565
6666``` rust
6767use console_utils :: {spinner, SpinnerType };
68-
69- // Display a standard spinner for 3 seconds
70- spinner (3.0 , SpinnerType :: Standard );
71-
72- // Display a dots spinner for 2 seconds
73- spinner (2.0 , SpinnerType :: Dots );
74-
75- // Display a custom spinner for 1 second (using custom frames)
76- spinner (1.0 , SpinnerType :: Custom (vec! [" 1" , " 2" , " 3" , " 4" , " 3" , " 2" ]));
77-
78- // Display a box spinner for 1.5 seconds
79- spinner (1.5 , SpinnerType :: Box );
80-
81- // Display a flip spinner for 2 seconds
82- spinner (2.0 , SpinnerType :: Flip );
68+ fn main () {
69+ // Display a standard spinner for 3 seconds
70+ spinner (3.0 , SpinnerType :: Standard );
71+
72+ // Display a dots spinner for 2 seconds
73+ spinner (2.0 , SpinnerType :: Dots );
74+
75+ // Display a custom spinner for 1 second (using custom frames)
76+ spinner (1.0 , SpinnerType :: Custom (vec! [" 1" , " 2" , " 3" , " 4" , " 3" , " 2" ]));
77+
78+ // Display a box spinner for 1.5 seconds
79+ spinner (1.5 , SpinnerType :: Box );
80+
81+ // Display a flip spinner for 2 seconds
82+ spinner (2.0 , SpinnerType :: Flip );
83+ }
8384```
8485
8586## Reveal Function
@@ -90,9 +91,27 @@ Displays a string gradually, revealing one character at a time with a specified
9091
9192``` rust
9293use console_utils :: reveal;
94+ fn main () {
95+ // Display "Hello World!" with a time interval of 0.1 seconds between each character and a new line after it's finished.
96+ reveal (" Hello World!" , 0.1 );
97+ }
98+ ```
99+
100+ ## Clear Line Function
101+
102+ Clears the current line in the console.
93103
94- // Display "Hello World!" with a time interval of 0.1 seconds between each character and a new line after it's finished.
95- reveal (" Hello World!" , 0.1 );
104+ This function uses ANSI escape codes to clear the entire line and move the cursor to the
105+ beginning of the line.
106+
107+ ### Usage
108+
109+ ``` rust
110+ use console_utils :: clear_line;
111+ fn main () {
112+ // Clear the current line
113+ clear_line ();
114+ }
96115```
97116
98117For more detailed documentation, please refer to the [ generated Rust Docs] ( https://docs.rs/console-utils/latest/console_utils/ ) .
0 commit comments