authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-08-10 01:48:41 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-08-10 01:48:41 -07:00
log8d1c6c7f6b73954123a448184f19c464fbe3b71f
tree742f11db3d3b1bf1f6871354788ee918f748367d
parentfa1b06e089dd45692cd6142f3194f31b40d62bde

add check for LICENSE.txt and use detectlicense for write check too

closes #83

3 files changed, 7 insertions(+), 6 deletions(-)

deps.zig+3-3
......@@ -60,7 +60,7 @@ pub fn fetch(exe: *std.build.LibExeObjStep) void {
6060 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/iguanaTLS", "c932f557865abaa1d06cd88e9b22a9f3e583fa59").step);
6161 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zfetch", "f51277414a2309f776fb79f3d55f26e37f9a54da").step);
6262 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "ac607e4e7ac36d46cc67c8786262578330543a36").step);
63 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "8f13721bd18c0e546841b6f2e11da839550d6287").step);
63 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "3ff57d0681b7bd7f8ca9bd092afa0b4bfe2f1afd").step);
6464 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-extras", "54abdc5bce0b243601ef4808bce1c29e1a46cdec").step);
6565 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-inquirer", "5cc2a5565d04fe2c0085f0d6818590e800d9dcf7").step);
6666 exe.step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-leven", "550cabd5a18ace5e67761bc5b867c10e926f4314").step);
......@@ -215,9 +215,9 @@ pub const package_data = struct {
215215 .deps = &[_]*Package{ &_tnj3qf44tpeq },
216216 };
217217 pub var _2ovav391ivak = Package{
218 .store = "/git/github.com/nektro/zig-detect-license/8f13721bd18c0e546841b6f2e11da839550d6287",
218 .store = "/git/github.com/nektro/zig-detect-license/3ff57d0681b7bd7f8ca9bd092afa0b4bfe2f1afd",
219219 .name = "detect-license",
220 .entry = "/git/github.com/nektro/zig-detect-license/8f13721bd18c0e546841b6f2e11da839550d6287/src/lib.zig",
220 .entry = "/git/github.com/nektro/zig-detect-license/3ff57d0681b7bd7f8ca9bd092afa0b4bfe2f1afd/src/lib.zig",
221221 .deps = &[_]*Package{ &_pt88y5d80m25, &_96h80ezrvj7i },
222222 };
223223 pub var _iecwp4b3bsfm = Package{
src/cmd/init.zig+3-2
......@@ -40,7 +40,8 @@ pub fn execute(args: [][]u8) !void {
4040 else => |ee| return ee,
4141 }) else null;
4242
43 const license = try inquirer.forString(stdout, stdin, "license:", gpa, try detectlicense.detectInDir(gpa, cwd));
43 const maybe_license_text = try detectlicense.detectInDir(gpa, cwd);
44 const license = try inquirer.forString(stdout, stdin, "license:", gpa, maybe_license_text);
4445
4546 const description = try inquirer.forString(stdout, stdin, "description:", gpa, null);
4647
......@@ -73,7 +74,7 @@ pub fn execute(args: [][]u8) !void {
7374 }
7475
7576 // ask about LICENSE
76 if (!(try extras.doesFileExist(null, "LICENSE"))) {
77 if (maybe_license_text == null) {
7778 if (detectlicense.licenses.find(license)) |text| {
7879 if (try inquirer.forConfirm(stdout, stdin, "It appears you don't have a LICENSE file defined, would you like init to add it for you?", gpa)) {
7980 var realtext = text;
zigmod.lock+1-1
......@@ -4,7 +4,7 @@ git https://github.com/nektro/arqv-ini commit-ddbe89bb0d9085e939bcbc713caeb2b7cf
44git https://github.com/nektro/iguanaTLS commit-c932f557865abaa1d06cd88e9b22a9f3e583fa59
55git https://github.com/nektro/zfetch commit-f51277414a2309f776fb79f3d55f26e37f9a54da
66git https://github.com/nektro/zig-ansi commit-ac607e4e7ac36d46cc67c8786262578330543a36
7git https://github.com/nektro/zig-detect-license commit-8f13721bd18c0e546841b6f2e11da839550d6287
7git https://github.com/nektro/zig-detect-license commit-3ff57d0681b7bd7f8ca9bd092afa0b4bfe2f1afd
88git https://github.com/nektro/zig-extras commit-54abdc5bce0b243601ef4808bce1c29e1a46cdec
99git https://github.com/nektro/zig-inquirer commit-5cc2a5565d04fe2c0085f0d6818590e800d9dcf7
1010git https://github.com/nektro/zig-leven commit-550cabd5a18ace5e67761bc5b867c10e926f4314