authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-01-19 01:32:59 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-01-19 01:32:59 -08:00
log4c4536d2f8ba108d3fe9a2555c9e2e633567b621
treec7b580737f295fef50263f8e4e09845d57181f67
parenta8cd50a5a6530aec048484d87d0f7f7c3f4bb978

cmd/init- use zig-time to properly fill in license year


4 files changed, 11 insertions(+), 4 deletions(-)

deps.zig+6-1
...@@ -69,6 +69,7 @@ pub const dirs = struct {...@@ -69,6 +69,7 @@ pub const dirs = struct {
69 pub const _qyrnfg0iwpzl = cache ++ "/git/github.com/nektro/zig-fs-check";69 pub const _qyrnfg0iwpzl = cache ++ "/git/github.com/nektro/zig-fs-check";
70 pub const _c1xirp1ota5p = cache ++ "/git/github.com/nektro/zig-inquirer";70 pub const _c1xirp1ota5p = cache ++ "/git/github.com/nektro/zig-inquirer";
71 pub const _u7sysdckdymi = cache ++ "/git/github.com/arqv/ini";71 pub const _u7sysdckdymi = cache ++ "/git/github.com/arqv/ini";
72 pub const _iecwp4b3bsfm = cache ++ "/git/github.com/nektro/zig-time";
72 pub const _o6ogpor87xc2 = cache ++ "/git/github.com/marlersoft/zigwin32";73 pub const _o6ogpor87xc2 = cache ++ "/git/github.com/marlersoft/zigwin32";
73};74};
7475
...@@ -147,9 +148,13 @@ pub const package_data = struct {...@@ -147,9 +148,13 @@ pub const package_data = struct {
147 .directory = dirs._u7sysdckdymi,148 .directory = dirs._u7sysdckdymi,
148 .pkg = Pkg{ .name = "ini", .path = .{ .path = dirs._u7sysdckdymi ++ "/src/ini.zig" }, .dependencies = null },149 .pkg = Pkg{ .name = "ini", .path = .{ .path = dirs._u7sysdckdymi ++ "/src/ini.zig" }, .dependencies = null },
149 };150 };
151 pub const _iecwp4b3bsfm = Package{
152 .directory = dirs._iecwp4b3bsfm,
153 .pkg = Pkg{ .name = "time", .path = .{ .path = dirs._iecwp4b3bsfm ++ "/time.zig" }, .dependencies = &.{ _tnj3qf44tpeq.pkg.? } },
154 };
150 pub const _89ujp8gq842x = Package{155 pub const _89ujp8gq842x = Package{
151 .directory = dirs._89ujp8gq842x,156 .directory = dirs._89ujp8gq842x,
152 .pkg = Pkg{ .name = "zigmod", .path = .{ .path = dirs._89ujp8gq842x ++ "/src/lib.zig" }, .dependencies = &.{ _csbnipaad8n7.pkg.?, _s84v9o48ucb0.pkg.?, _2ta738wrqbaq.pkg.?, _0npcrzfdlrvk.pkg.?, _ejw82j2ipa0e.pkg.?, _ocmr9rtohgcc.pkg.?, _tnj3qf44tpeq.pkg.?, _2ovav391ivak.pkg.?, _c1xirp1ota5p.pkg.?, _u7sysdckdymi.pkg.? } },157 .pkg = Pkg{ .name = "zigmod", .path = .{ .path = dirs._89ujp8gq842x ++ "/src/lib.zig" }, .dependencies = &.{ _csbnipaad8n7.pkg.?, _s84v9o48ucb0.pkg.?, _2ta738wrqbaq.pkg.?, _0npcrzfdlrvk.pkg.?, _ejw82j2ipa0e.pkg.?, _ocmr9rtohgcc.pkg.?, _tnj3qf44tpeq.pkg.?, _2ovav391ivak.pkg.?, _c1xirp1ota5p.pkg.?, _u7sysdckdymi.pkg.?, _f7dubzb7cyqe.pkg.?, _iecwp4b3bsfm.pkg.? } },
153 };158 };
154 pub const _o6ogpor87xc2 = Package{159 pub const _o6ogpor87xc2 = Package{
155 .directory = dirs._o6ogpor87xc2,160 .directory = dirs._o6ogpor87xc2,
src/cmd/init.zig+3-3
...@@ -6,13 +6,13 @@ const inquirer = @import("inquirer");...@@ -6,13 +6,13 @@ const inquirer = @import("inquirer");
6const detectlicense = @import("detect-license");6const detectlicense = @import("detect-license");
7const knownfolders = @import("known-folders");7const knownfolders = @import("known-folders");
8const ini = @import("ini");8const ini = @import("ini");
9const time = @import("time");
10
9const u = @import("./../util/index.zig");11const u = @import("./../util/index.zig");
1012
11//13//
12//14//
1315
14const s_in_y = std.time.s_per_week * 52;
15
16pub fn execute(args: [][]u8) !void {16pub fn execute(args: [][]u8) !void {
17 _ = args;17 _ = args;
1818
...@@ -84,7 +84,7 @@ pub fn execute(args: [][]u8) !void {...@@ -84,7 +84,7 @@ pub fn execute(args: [][]u8) !void {
84 "year:",84 "year:",
85 string,85 string,
86 "{s}",86 "{s}",
87 try std.fmt.allocPrint(gpa, "{d}", .{1970 + @divFloor(std.time.timestamp(), s_in_y)}),87 try std.fmt.allocPrint(gpa, "{d}", .{time.DateTime.now().years}),
88 ));88 ));
89 realtext = try std.mem.replaceOwned(u8, gpa, realtext, "<copyright holders>", try inquirer.forString(89 realtext = try std.mem.replaceOwned(u8, gpa, realtext, "<copyright holders>", try inquirer.forString(
90 stdout,90 stdout,
zig.mod+1
...@@ -41,6 +41,7 @@ dependencies:...@@ -41,6 +41,7 @@ dependencies:
41 - src: git https://github.com/nektro/zig-detect-license41 - src: git https://github.com/nektro/zig-detect-license
42 - src: git https://github.com/nektro/zig-inquirer42 - src: git https://github.com/nektro/zig-inquirer
43 - src: git https://github.com/arqv/ini43 - src: git https://github.com/arqv/ini
44 - src: git https://github.com/nektro/zig-time
4445
45root_dependencies:46root_dependencies:
46 - src: git https://github.com/marlersoft/zigwin3247 - src: git https://github.com/marlersoft/zigwin32
zigmod.lock+1
...@@ -17,4 +17,5 @@ git https://github.com/nektro/zig-leven commit-ab852cf74fa0b4edc530d925f0654b62c...@@ -17,4 +17,5 @@ git https://github.com/nektro/zig-leven commit-ab852cf74fa0b4edc530d925f0654b62c
17git https://github.com/nektro/zig-fs-check commit-dcd8da90fcb8bf3c9887e713bf0ec072bc897dd517git https://github.com/nektro/zig-fs-check commit-dcd8da90fcb8bf3c9887e713bf0ec072bc897dd5
18git https://github.com/nektro/zig-inquirer commit-14c3492c46f9765c3e77436741794d1a3118cbee18git https://github.com/nektro/zig-inquirer commit-14c3492c46f9765c3e77436741794d1a3118cbee
19git https://github.com/arqv/ini commit-b93f5b5ff9449f9af68ae3081f6a5e858b6698d919git https://github.com/arqv/ini commit-b93f5b5ff9449f9af68ae3081f6a5e858b6698d9
20git https://github.com/nektro/zig-time commit-d36cf720d305ffcf3003d855feeb00a10913bc56
20git https://github.com/marlersoft/zigwin32 commit-a74c9dae6a1ccd361eb9a1d146a09c08d22f02b021git https://github.com/marlersoft/zigwin32 commit-a74c9dae6a1ccd361eb9a1d146a09c08d22f02b0