@@ -29,7 +29,11 @@ fn addExec(ctx: chilli.CommandContext) !void {
2929 const precision = try ctx .getFlag ("precision" , f64 );
3030 const result = @as (f64 , @floatFromInt (a )) + @as (f64 , @floatFromInt (b ));
3131
32- const stdout = std .fs .File .stdout ().deprecatedWriter ();
32+ const io = std .Options .debug_io ;
33+ var stdout_buf : [4096 ]u8 = undefined ;
34+ var stdout_fw = std .Io .File .stdout ().writer (io , & stdout_buf );
35+ defer stdout_fw .flush () catch {};
36+ const stdout = & stdout_fw .interface ;
3337 const precision_int : u32 = @intFromFloat (@max (0.0 , @min (precision , 20.0 )));
3438
3539 var buf : [64 ]u8 = undefined ;
@@ -43,18 +47,22 @@ fn addExec(ctx: chilli.CommandContext) !void {
4347
4448fn greetExec (ctx : chilli.CommandContext ) ! void {
4549 const name = try ctx .getArg ("name" , []const u8 );
46- const stdout = std .fs .File .stdout ().deprecatedWriter ();
50+ const io = std .Options .debug_io ;
51+ var stdout_buf : [4096 ]u8 = undefined ;
52+ var stdout_fw = std .Io .File .stdout ().writer (io , & stdout_buf );
53+ defer stdout_fw .flush () catch {};
54+ const stdout = & stdout_fw .interface ;
4755 try stdout .print ("Hello, {s}!\n " , .{name });
4856}
4957
50- pub fn main () anyerror ! void {
51- var gpa = std .heap .GeneralPurposeAllocator (.{}){} ;
58+ pub fn main (init : std.process.Init.Minimal ) anyerror ! void {
59+ var gpa : std .heap .DebugAllocator (.{}) = .init ;
5260 defer _ = gpa .deinit ();
5361 const allocator = gpa .allocator ();
5462
5563 var app_context = AppContext {
5664 .log_level = 0 ,
57- .start_time = std . time . timestamp () ,
65+ .start_time = 0 ,
5866 };
5967
6068 var root_cmd = try chilli .Command .init (allocator , .{
@@ -107,7 +115,7 @@ pub fn main() anyerror!void {
107115 .default_value = .{ .String = "World" },
108116 });
109117
110- try root_cmd .run (& app_context );
118+ try root_cmd .run (init . args , & app_context );
111119}
112120
113121// Example Invocations
0 commit comments