authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-07-31 18:55:51 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-07-31 18:55:51 -07:00
log088b0ec9662184edc155298e8f899a33dfb42a93
treec989e82a0977af79441401086f4a4d4816744b52
parentc3957c42b6ef932346f7d4fe11b5eeda25046e90

cmd/init- put cwd into a var


1 files changed, 3 insertions(+), 2 deletions(-)

src/cmd/init.zig+3-2
......@@ -19,6 +19,7 @@ pub fn execute(args: [][]u8) !void {
1919
2020 const stdout = std.io.getStdOut().writer();
2121 const stdin = std.io.getStdIn().reader();
22 const cwd = std.fs.cwd();
2223
2324 const id = try inquirer.answer(stdout, "ID (this gets autogenerated):", []const u8, "{s}", try u.random_string(48));
2425
......@@ -37,7 +38,7 @@ pub fn execute(args: [][]u8) !void {
3738 else => return err,
3839 }) else null;
3940
40 const license = try inquirer.forString(stdout, stdin, "license:", gpa, try detectlicense.detectInDir(gpa, std.fs.cwd()));
41 const license = try inquirer.forString(stdout, stdin, "license:", gpa, try detectlicense.detectInDir(gpa, cwd));
4142
4243 const description = try inquirer.forString(stdout, stdin, "description:", gpa, null);
4344
......@@ -56,7 +57,7 @@ pub fn execute(args: [][]u8) !void {
5657 std.debug.print("okay. quitting...", .{});
5758 },
5859 true => {
59 const file = try std.fs.cwd().createFile("zig.mod", .{});
60 const file = try cwd.createFile("zig.mod", .{});
6061 defer file.close();
6162 const w = file.writer();
6263 switch (ptype) {