mod(examples/progress): show multiple different configuration options
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 59s
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 59s
This commit is contained in:
@@ -37,20 +37,54 @@ pub fn main() !void {
|
||||
defer renderer.deinit();
|
||||
|
||||
var progress_percent: u8 = 0;
|
||||
var progress: App.Progress(.progress) = .init(&app.queue, .{
|
||||
.percent = .{ .enabled = true },
|
||||
.fg = .green,
|
||||
.bg = .grey,
|
||||
});
|
||||
var quit_text: QuitText = .{};
|
||||
|
||||
var container = try App.Container.init(allocator, .{
|
||||
.layout = .{ .padding = .all(5) },
|
||||
.layout = .{ .padding = .all(5), .direction = .vertical },
|
||||
}, quit_text.element());
|
||||
defer container.deinit();
|
||||
|
||||
try container.append(try App.Container.init(allocator, .{}, progress.element()));
|
||||
|
||||
{
|
||||
var progress: App.Progress(.progress) = .init(&app.queue, .{
|
||||
.percent = .{
|
||||
.enabled = true,
|
||||
.alignment = .left,
|
||||
},
|
||||
.fg = .blue,
|
||||
.bg = .grey,
|
||||
});
|
||||
try container.append(try App.Container.init(allocator, .{}, progress.element()));
|
||||
}
|
||||
{
|
||||
var progress: App.Progress(.progress) = .init(&app.queue, .{
|
||||
.percent = .{
|
||||
.enabled = true,
|
||||
.alignment = .middle, // default
|
||||
},
|
||||
.fg = .red,
|
||||
.bg = .grey,
|
||||
});
|
||||
try container.append(try App.Container.init(allocator, .{}, progress.element()));
|
||||
}
|
||||
{
|
||||
var progress: App.Progress(.progress) = .init(&app.queue, .{
|
||||
.percent = .{
|
||||
.enabled = true,
|
||||
.alignment = .right,
|
||||
},
|
||||
.fg = .green,
|
||||
.bg = .grey,
|
||||
});
|
||||
try container.append(try App.Container.init(allocator, .{}, progress.element()));
|
||||
}
|
||||
{
|
||||
var progress: App.Progress(.progress) = .init(&app.queue, .{
|
||||
.percent = .{ .enabled = false },
|
||||
.fg = .default,
|
||||
.bg = .grey,
|
||||
});
|
||||
try container.append(try App.Container.init(allocator, .{}, progress.element()));
|
||||
}
|
||||
try app.start();
|
||||
defer app.stop() catch |err| log.err("Failed to stop application: {any}", .{err});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user