diff --git a/build.zig.zon b/build.zig.zon index 489696b..60c7f8c 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -3,8 +3,8 @@ .version = "0.0.0", .dependencies = .{ .zmpl = .{ - .url = "https://github.com/jetzig-framework/zmpl/archive/ed99a1604b37fb05b0f5843a3288588f3dfe2e63.tar.gz", - .hash = "1220771fe742fc620872051b92082d370549ed857e5a93ae43f92c5767ca2aaf42b1", + .url = "https://github.com/jetzig-framework/zmpl/archive/2c98f476dc1b9fb264410146b9a687f0ab955568.tar.gz", + .hash = "1220d0f563ecff65c51ca43835917b807f9eac8fb830fdff7c62cfd375a253529274", }, .args = .{ .url = "https://github.com/MasterQ32/zig-args/archive/89f18a104d9c13763b90e97d6b4ce133da8a3e2b.tar.gz", diff --git a/cli/init.zig b/cli/init.zig index 2be0815..c718948 100644 --- a/cli/init.zig +++ b/cli/init.zig @@ -192,7 +192,7 @@ pub fn run( null, ); - try runCommand(allocator, install_dir, &[_][]const u8{ + try runCommand(allocator, real_path, &[_][]const u8{ "zig", "fetch", "--save", @@ -219,8 +219,8 @@ pub fn run( , .{real_path}); } -fn runCommand(allocator: std.mem.Allocator, install_dir: std.fs.Dir, argv: []const []const u8) !void { - const result = try std.process.Child.run(.{ .allocator = allocator, .argv = argv, .cwd_dir = install_dir }); +fn runCommand(allocator: std.mem.Allocator, install_path: []const u8, argv: []const []const u8) !void { + const result = try std.process.Child.run(.{ .allocator = allocator, .argv = argv, .cwd = install_path }); defer allocator.free(result.stdout); defer allocator.free(result.stderr); @@ -381,10 +381,11 @@ fn promptInput( const input = try reader.readUntilDelimiterOrEofAlloc(allocator, '\n', max_read_bytes); if (input) |capture| { defer allocator.free(capture); + const stripped_input = strip(capture); - if (std.mem.eql(u8, capture, "")) { + if (std.mem.eql(u8, stripped_input, "")) { if (options.default) |default| return try allocator.dupe(u8, strip(default)); - } else return try allocator.dupe(u8, strip(capture)); + } else return try allocator.dupe(u8, stripped_input); } } }