docs: Update README
This commit is contained in:
parent
9c9ffdf06c
commit
883a534b32
1 changed files with 39 additions and 1 deletions
38
README.md
38
README.md
|
@ -1,3 +1,41 @@
|
||||||
# zpinner
|
# zpinner
|
||||||
|
|
||||||
Nice zpinner in the terminal made in zig.
|
Nice zpinner in the terminal made in zig.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
```zig
|
||||||
|
const std = @import("std");
|
||||||
|
const zpinner = @import("zpinner.zig");
|
||||||
|
|
||||||
|
pub fn main() !void {
|
||||||
|
const stdout_file = std.io.getStdOut().writer();
|
||||||
|
var zpin = zpinner.new(stdout_file.any(), .{});
|
||||||
|
zpin.set_indicator(zpinner.Moon);
|
||||||
|
zpin.set_suffix(" calculating route to the moon");
|
||||||
|
try zpin.start();
|
||||||
|
std.time.sleep(5 * std.time.ns_per_s);
|
||||||
|
try zpin.stop();
|
||||||
|
zpin.set_suffix(" counting snakes");
|
||||||
|
zpin.set_indicator(zpinner.Snake);
|
||||||
|
try zpin.start();
|
||||||
|
std.time.sleep(5 * std.time.ns_per_s);
|
||||||
|
zpin.set_indicator(zpinner.Earth);
|
||||||
|
zpin.set_suffix(" calculating route back to earth");
|
||||||
|
std.time.sleep(5 * std.time.ns_per_s);
|
||||||
|
try zpin.stop();
|
||||||
|
zpin.set_suffix(" calculating next week weather");
|
||||||
|
zpin.set_indicator(zpinner.Weather);
|
||||||
|
try zpin.start();
|
||||||
|
std.time.sleep(5 * std.time.ns_per_s);
|
||||||
|
try zpin.stop();
|
||||||
|
zpin.set_suffix(" ZzZzz...");
|
||||||
|
zpin.set_indicator(zpinner.Clock);
|
||||||
|
try zpin.start();
|
||||||
|
std.time.sleep(5 * std.time.ns_per_s);
|
||||||
|
try zpin.stop();
|
||||||
|
|
||||||
|
try stdout_file.print("work done\n", .{});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue