| author | |
| committer | |
| log | 29460c33bd91ab7169f9edeb789f9009ffe56e87 |
| tree | e325d78d2cd12bdf14ad7253407b26f0b0ed0374 |
| parent | 13b67cc5ef159d53e245cea685c3705656bb7f53 |
5 files changed, 56 insertions(+), 1 deletions(-)
deps.zig+4-1| ... | @@ -37,6 +37,7 @@ pub const _ids = .{ | ... | @@ -37,6 +37,7 @@ pub const _ids = .{ |
| 37 | "yyhw90zkzgmubwpp87n0pzf936n850an66y1c6qan5y6sogv", | 37 | "yyhw90zkzgmubwpp87n0pzf936n850an66y1c6qan5y6sogv", |
| 38 | "u9w9dpp6p804p38o3u87f437pf942wxunyjite27dyhtu7ns", | 38 | "u9w9dpp6p804p38o3u87f437pf942wxunyjite27dyhtu7ns", |
| 39 | "ocmr9rtohgccd6gm6tp8b1yzylyzkqwvo1q4btrsvj0cse9y", | 39 | "ocmr9rtohgccd6gm6tp8b1yzylyzkqwvo1q4btrsvj0cse9y", |
| 40 | "tnj3qf44tpeq469x94qnu7jzus5n7sen9ewrrn8kldngbac0", | ||
| 40 | }; | 41 | }; |
| 41 | 42 | ||
| 42 | pub const _paths = .{ | 43 | pub const _paths = .{ |
| ... | @@ -51,6 +52,7 @@ pub const _paths = .{ | ... | @@ -51,6 +52,7 @@ pub const _paths = .{ |
| 51 | "/git/github.com/MasterQ32/zig-network/", | 52 | "/git/github.com/MasterQ32/zig-network/", |
| 52 | "/git/github.com/MasterQ32/zig-uri/", | 53 | "/git/github.com/MasterQ32/zig-uri/", |
| 53 | "/git/github.com/nektro/zig-json/", | 54 | "/git/github.com/nektro/zig-json/", |
| 55 | "/v/http/aquila.red/1/nektro/range/v0.1.tar.gz/d2f72fdd/", | ||
| 54 | }; | 56 | }; |
| 55 | 57 | ||
| 56 | pub const package_data = struct { | 58 | pub const package_data = struct { |
| ... | @@ -63,7 +65,8 @@ pub const package_data = struct { | ... | @@ -63,7 +65,8 @@ pub const package_data = struct { |
| 63 | pub const _u9w9dpp6p804p38o3u87f437pf942wxunyjite27dyhtu7ns = std.build.Pkg{ .name = "uri", .path = cache ++ "/git/github.com/MasterQ32/zig-uri/uri.zig", .dependencies = &[_]std.build.Pkg{ } }; | 65 | pub const _u9w9dpp6p804p38o3u87f437pf942wxunyjite27dyhtu7ns = std.build.Pkg{ .name = "uri", .path = cache ++ "/git/github.com/MasterQ32/zig-uri/uri.zig", .dependencies = &[_]std.build.Pkg{ } }; |
| 64 | pub const _ejw82j2ipa0eul25ohgdh6yy5nkrtn2pf0rq18m0079w6wj7 = std.build.Pkg{ .name = "zfetch", .path = cache ++ "/git/github.com/truemedian/zfetch/src/main.zig", .dependencies = &[_]std.build.Pkg{ _9k24gimke1anv665ilg4si32ayl3dsaqgmdfdpu1ceoky8tl, _csbnipaad8n77buaszsnjvlmn6j173fl7pkprsctelswjywe, _yyhw90zkzgmubwpp87n0pzf936n850an66y1c6qan5y6sogv, _u9w9dpp6p804p38o3u87f437pf942wxunyjite27dyhtu7ns, } }; | 66 | pub const _ejw82j2ipa0eul25ohgdh6yy5nkrtn2pf0rq18m0079w6wj7 = std.build.Pkg{ .name = "zfetch", .path = cache ++ "/git/github.com/truemedian/zfetch/src/main.zig", .dependencies = &[_]std.build.Pkg{ _9k24gimke1anv665ilg4si32ayl3dsaqgmdfdpu1ceoky8tl, _csbnipaad8n77buaszsnjvlmn6j173fl7pkprsctelswjywe, _yyhw90zkzgmubwpp87n0pzf936n850an66y1c6qan5y6sogv, _u9w9dpp6p804p38o3u87f437pf942wxunyjite27dyhtu7ns, } }; |
| 65 | pub const _ocmr9rtohgccd6gm6tp8b1yzylyzkqwvo1q4btrsvj0cse9y = std.build.Pkg{ .name = "json", .path = cache ++ "/git/github.com/nektro/zig-json/src/lib.zig", .dependencies = &[_]std.build.Pkg{ } }; | 67 | pub const _ocmr9rtohgccd6gm6tp8b1yzylyzkqwvo1q4btrsvj0cse9y = std.build.Pkg{ .name = "json", .path = cache ++ "/git/github.com/nektro/zig-json/src/lib.zig", .dependencies = &[_]std.build.Pkg{ } }; |
| 66 | pub const _89ujp8gq842x6mzok8feypwze138n2d96zpugw44hcq7406r = std.build.Pkg{ .name = "zigmod", .path = cache ++ "/../../src/lib.zig", .dependencies = &[_]std.build.Pkg{ _s84v9o48ucb0xq0cmzq0cn433hgw0iaqztugja16h8bzxu3h, _2ta738wrqbaqzl3iwzoo8nj35k9ynwz5p5iyz80ryrpp4ttf, _0npcrzfdlrvkf44mzjo8bduj9gmqyefo0j3rstt6b0pm2r6r, _ejw82j2ipa0eul25ohgdh6yy5nkrtn2pf0rq18m0079w6wj7, _ocmr9rtohgccd6gm6tp8b1yzylyzkqwvo1q4btrsvj0cse9y, } }; | 68 | pub const _tnj3qf44tpeq469x94qnu7jzus5n7sen9ewrrn8kldngbac0 = std.build.Pkg{ .name = "range", .path = cache ++ "/v/http/aquila.red/1/nektro/range/v0.1.tar.gz/d2f72fdd/src/lib.zig", .dependencies = &[_]std.build.Pkg{ } }; |
| 69 | pub const _89ujp8gq842x6mzok8feypwze138n2d96zpugw44hcq7406r = std.build.Pkg{ .name = "zigmod", .path = cache ++ "/../../src/lib.zig", .dependencies = &[_]std.build.Pkg{ _s84v9o48ucb0xq0cmzq0cn433hgw0iaqztugja16h8bzxu3h, _2ta738wrqbaqzl3iwzoo8nj35k9ynwz5p5iyz80ryrpp4ttf, _0npcrzfdlrvkf44mzjo8bduj9gmqyefo0j3rstt6b0pm2r6r, _ejw82j2ipa0eul25ohgdh6yy5nkrtn2pf0rq18m0079w6wj7, _ocmr9rtohgccd6gm6tp8b1yzylyzkqwvo1q4btrsvj0cse9y, _tnj3qf44tpeq469x94qnu7jzus5n7sen9ewrrn8kldngbac0, } }; | ||
| 67 | }; | 70 | }; |
| 68 | 71 | ||
| 69 | pub const packages = &[_]std.build.Pkg{ | 72 | pub const packages = &[_]std.build.Pkg{ |
src/cmd/zpm.zig+2| ... | @@ -12,6 +12,7 @@ const u = @import("./../util/index.zig"); | ... | @@ -12,6 +12,7 @@ const u = @import("./../util/index.zig"); |
| 12 | pub const commands = struct { | 12 | pub const commands = struct { |
| 13 | pub const add = @import("./zpm_add.zig"); | 13 | pub const add = @import("./zpm_add.zig"); |
| 14 | pub const showjson = @import("./zpm/showjson.zig"); | 14 | pub const showjson = @import("./zpm/showjson.zig"); |
| 15 | pub const tags = @import("./zpm/tags.zig"); | ||
| 15 | }; | 16 | }; |
| 16 | 17 | ||
| 17 | pub const server_root = "https://zpm.random-projects.net/api"; | 18 | pub const server_root = "https://zpm.random-projects.net/api"; |
| ... | @@ -26,6 +27,7 @@ pub fn execute(args: [][]u8) !void { | ... | @@ -26,6 +27,7 @@ pub fn execute(args: [][]u8) !void { |
| 26 | \\The subcommands available are: | 27 | \\The subcommands available are: |
| 27 | \\ - add Append this package to your dependencies | 28 | \\ - add Append this package to your dependencies |
| 28 | \\ - showjson Print raw json from queried API responses | 29 | \\ - showjson Print raw json from queried API responses |
| 30 | \\ - tags Print the list of tags available on the server. | ||
| 29 | }); | 31 | }); |
| 30 | return; | 32 | return; |
| 31 | } | 33 | } |
src/cmd/zpm/tags.zig created+47| ... | @@ -0,0 +1,47 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const gpa = std.heap.c_allocator; | ||
| 3 | const out = std.io.getStdOut().writer(); | ||
| 4 | |||
| 5 | const zfetch = @import("zfetch"); | ||
| 6 | const json = @import("json"); | ||
| 7 | const range = @import("range").range; | ||
| 8 | |||
| 9 | const u = @import("./../util/index.zig"); | ||
| 10 | const zpm = @import("./../zpm.zig"); | ||
| 11 | |||
| 12 | // | ||
| 13 | // | ||
| 14 | |||
| 15 | pub fn execute(args: [][]u8) !void { | ||
| 16 | const url = try std.mem.join(gpa, "/", &.{ zpm.server_root, "tags" }); | ||
| 17 | const val = try zpm.server_fetch(url); | ||
| 18 | |||
| 19 | const name_col_width = blk: { | ||
| 20 | var w: usize = 0; | ||
| 21 | for (val.Array) |tag| { | ||
| 22 | const len = tag.get("name").?.String.len; | ||
| 23 | if (len > w) { | ||
| 24 | w = len; | ||
| 25 | } | ||
| 26 | } | ||
| 27 | break :blk w + 4; | ||
| 28 | }; | ||
| 29 | |||
| 30 | try out.writeAll("NAME"); | ||
| 31 | try print_c_n(' ', name_col_width - 4); | ||
| 32 | try out.writeAll("DESCRIPTION\n"); | ||
| 33 | |||
| 34 | for (val.Array) |tag| { | ||
| 35 | const name = tag.get("name").?.String; | ||
| 36 | try out.writeAll(name); | ||
| 37 | try print_c_n(' ', name_col_width - name.len); | ||
| 38 | try out.writeAll(tag.get("description").?.String); | ||
| 39 | try out.writeAll("\n"); | ||
| 40 | } | ||
| 41 | } | ||
| 42 | |||
| 43 | fn print_c_n(c: u8, n: usize) !void { | ||
| 44 | for (range(n)) |_, i| { | ||
| 45 | try out.writeAll(&.{c}); | ||
| 46 | } | ||
| 47 | } | ||
zig.mod+2| ... | @@ -39,5 +39,7 @@ dependencies: | ... | @@ -39,5 +39,7 @@ dependencies: |
| 39 | 39 | ||
| 40 | - src: git https://github.com/nektro/zig-json | 40 | - src: git https://github.com/nektro/zig-json |
| 41 | 41 | ||
| 42 | - src: http https://aquila.red/1/nektro/range/v0.1.tar.gz sha256-d2f72fdd8cdb8 0 1 | ||
| 43 | |||
| 42 | dev_dependencies: | 44 | dev_dependencies: |
| 43 | - src: git https://github.com/nektro/zig-ansi | 45 | - src: git https://github.com/nektro/zig-ansi |
zig.sum+1| ... | @@ -8,3 +8,4 @@ blake3-f7f97ba003d59243359f9f1b2a1a3af775c1655447611ff21d9b8946ff6f02ad git/gith | ... | @@ -8,3 +8,4 @@ blake3-f7f97ba003d59243359f9f1b2a1a3af775c1655447611ff21d9b8946ff6f02ad git/gith |
| 8 | blake3-900f4c0cb1e7078b8e7a3f022efe81444cd353a1788eb520683512b7815b788a git/github.com/MasterQ32/zig-network | 8 | blake3-900f4c0cb1e7078b8e7a3f022efe81444cd353a1788eb520683512b7815b788a git/github.com/MasterQ32/zig-network |
| 9 | blake3-754b1b7e57b716ca042a9fc5c262e4931a804bddd52df695ec2b5476d0df0005 git/github.com/MasterQ32/zig-uri | 9 | blake3-754b1b7e57b716ca042a9fc5c262e4931a804bddd52df695ec2b5476d0df0005 git/github.com/MasterQ32/zig-uri |
| 10 | blake3-155960bc30c27ccee4f6f10cfb0398d1bcec367abaabb16f18de6176bd92112c git/github.com/nektro/zig-json | 10 | blake3-155960bc30c27ccee4f6f10cfb0398d1bcec367abaabb16f18de6176bd92112c git/github.com/nektro/zig-json |
| 11 | blake3-09698753782139ab4877d08f33235170836f68b73e482b65cdee5637a6addf86 v/http/aquila.red/1/nektro/range/v0.1.tar.gz/d2f72fdd |