Make the weather build flag better.
This commit is contained in:
parent
329c946c40
commit
7cf25f7d38
|
@ -23,11 +23,16 @@ pub fn build(b: *Builder) void {
|
|||
"use debug allocator for testing",
|
||||
) orelse false;
|
||||
exe.addBuildOption(bool, "debug_allocator", debug_allocator);
|
||||
const weather_location = b.option(
|
||||
var weather_location = b.option(
|
||||
[]const u8,
|
||||
"weather_location",
|
||||
"weather_location",
|
||||
) orelse "\"\"";
|
||||
) orelse "";
|
||||
if (weather_location.len == 0) {
|
||||
weather_location = "\"\"";
|
||||
} else if (weather_location[0] != '"') {
|
||||
weather_location = std.fmt.allocPrint(std.heap.page_allocator, "\"{}\"", .{weather_location}) catch "\"\"";
|
||||
}
|
||||
exe.addBuildOption([]const u8, "weather_location", weather_location);
|
||||
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@ pub fn main() !void {
|
|||
//&Widget.init(&textWidget.New("owo", "potato")), // 4KiB
|
||||
//&Widget.init(&textWidget.New("uwu", "tomato")), // 4KiB
|
||||
&Widget.init(&cpuWidget.New(&br)), // 4.08KiB
|
||||
//&Widget.init(&memoryWidget.New(&br)), // 4.08KiB
|
||||
//&Widget.init(&weatherWidget.New(allocator, &br, @import("build_options").weather_location)), // 16.16KiB
|
||||
//&Widget.init(&batteryWidget.New(allocator, &br)), // 12.11KiB
|
||||
//&Widget.init(&timeWidget.New(allocator, &br)), // 32.46KiB
|
||||
&Widget.init(&memoryWidget.New(&br)), // 4.08KiB
|
||||
&Widget.init(&weatherWidget.New(allocator, &br, @import("build_options").weather_location)), // 16.16KiB
|
||||
&Widget.init(&batteryWidget.New(allocator, &br)), // 12.11KiB
|
||||
&Widget.init(&timeWidget.New(allocator, &br)), // 32.46KiB
|
||||
};
|
||||
bar.widgets = widgets[0..];
|
||||
try br.start();
|
||||
|
|
Loading…
Reference in a new issue