| author | |
| committer | |
| log | e545025a089e4512a95c147ba4a2773553817c74 |
| tree | 9a9cf538f780b7a784a730acb802b61abe40e41b |
| parent | 5a69da98a707e3e638af7204e6dbb80bef0b186c |
3 files changed, 3 insertions(+), 9 deletions(-)
src/cmd/zpm/add.zig+2-1| ... | @@ -1,6 +1,7 @@ | ... | @@ -1,6 +1,7 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const gpa = std.heap.c_allocator; | 2 | const gpa = std.heap.c_allocator; |
| 3 | const zfetch = @import("zfetch"); | 3 | const zfetch = @import("zfetch"); |
| 4 | const extras = @import("extras"); | ||
| 4 | 5 | ||
| 5 | const zigmod = @import("../../lib.zig"); | 6 | const zigmod = @import("../../lib.zig"); |
| 6 | const u = @import("./../../util/index.zig"); | 7 | const u = @import("./../../util/index.zig"); |
| ... | @@ -62,7 +63,7 @@ pub fn execute(self_name: []const u8, args: [][]u8) !void { | ... | @@ -62,7 +63,7 @@ pub fn execute(self_name: []const u8, args: [][]u8) !void { |
| 62 | 63 | ||
| 63 | const file_w = file.writer(); | 64 | const file_w = file.writer(); |
| 64 | try file_w.writeAll("\n"); | 65 | try file_w.writeAll("\n"); |
| 65 | try file_w.print(" - src: git {s}\n", .{u.trim_suffix(found.git, ".git")}); | 66 | try file_w.print(" - src: git {s}\n", .{extras.trimSuffix(found.git, ".git")}); |
| 66 | if (!(has_zigdotmod or has_zigmodyml)) { | 67 | if (!(has_zigdotmod or has_zigmodyml)) { |
| 67 | try file_w.print(" name: {s}\n", .{found.name}); | 68 | try file_w.print(" name: {s}\n", .{found.name}); |
| 68 | try file_w.print(" main: {s}\n", .{found.root_file[1..]}); | 69 | try file_w.print(" main: {s}\n", .{found.root_file[1..]}); |
src/util/dep.zig+1-1| ... | @@ -41,7 +41,7 @@ pub const Dep = struct { | ... | @@ -41,7 +41,7 @@ pub const Dep = struct { |
| 41 | p = extras.trimPrefix(p, "http://"); | 41 | p = extras.trimPrefix(p, "http://"); |
| 42 | p = extras.trimPrefix(p, "https://"); | 42 | p = extras.trimPrefix(p, "https://"); |
| 43 | p = extras.trimPrefix(p, "git://"); | 43 | p = extras.trimPrefix(p, "git://"); |
| 44 | p = u.trim_suffix(p, ".git"); | 44 | p = extras.trimSuffix(p, ".git"); |
| 45 | p = try std.mem.join(alloc, "/", &.{ @tagName(self.type), p }); | 45 | p = try std.mem.join(alloc, "/", &.{ @tagName(self.type), p }); |
| 46 | return p; | 46 | return p; |
| 47 | } | 47 | } |
src/util/funcs.zig-7| ... | @@ -46,13 +46,6 @@ pub fn split(alloc: std.mem.Allocator, in: string, delim: string) ![]string { | ... | @@ -46,13 +46,6 @@ pub fn split(alloc: std.mem.Allocator, in: string, delim: string) ![]string { |
| 46 | return list.toOwnedSlice(); | 46 | return list.toOwnedSlice(); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | pub fn trim_suffix(in: string, suffix: string) string { | ||
| 50 | if (std.mem.endsWith(u8, in, suffix)) { | ||
| 51 | return in[0 .. in.len - suffix.len]; | ||
| 52 | } | ||
| 53 | return in; | ||
| 54 | } | ||
| 55 | |||
| 56 | pub fn list_contains_gen(comptime T: type, haystack: []const T, needle: T) bool { | 49 | pub fn list_contains_gen(comptime T: type, haystack: []const T, needle: T) bool { |
| 57 | for (haystack) |item| { | 50 | for (haystack) |item| { |
| 58 | if (item.eql(needle)) { | 51 | if (item.eql(needle)) { |