diff --git a/README.md b/README.md index a23f293..20af379 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Browser command line -The idea is to transform api methods in command line interface +The idea is to transform api methods into command line interface The default shell command, like: @@ -24,7 +24,7 @@ wacli ain On your website you will need to use `.well-know/wacli.json` file: -```jsonc +```js { "api": "", "bin": { @@ -38,7 +38,7 @@ On your website you will need to use `.well-know/wacli.json` file: "headers": Array, "aliases": [{ "alias": "" | ["short_hand","long_hand"], - "type": "path" | "method" | "bin", + "type": "path" | "method" | "bin" | "uri", "description": "description of cli command" "content": "" }], @@ -152,7 +152,7 @@ You can create registry, by writing to `.well-know/wacli.json` next lines You can also get help on all api methods using the command ```sh -wacli help codeberg.org +wacli help git.0ut0f.space ``` Settings format is on Linux by address `$HOME/.config/wacli/wacfg.json` diff --git a/example/.well-known/git.0ut0f.space/wacli.json b/examples/git.0ut0f.space/.well-known/wacli.json similarity index 100% rename from example/.well-known/git.0ut0f.space/wacli.json rename to examples/git.0ut0f.space/.well-known/wacli.json diff --git a/examples/settings.json b/examples/settings.json new file mode 100644 index 0000000..dd9fbc7 --- /dev/null +++ b/examples/settings.json @@ -0,0 +1,8 @@ +{ + "db_path": "$HOME/.cache/wacrd.db", + "install_dir": "$HOME/.local/bin", + "uri_schemes": { + "registry": "https://wacli.ofs.lol" + } +} + diff --git a/examples/wacli.ofs.lol/.well-known/wacli.json b/examples/wacli.ofs.lol/.well-known/wacli.json new file mode 100644 index 0000000..3aa34a8 --- /dev/null +++ b/examples/wacli.ofs.lol/.well-known/wacli.json @@ -0,0 +1,16 @@ +{ + "registry": true, + "manifests": { + "forgejo": { + "path": "https://wacli.ofs.lol/registry/forgejo.json" + } + }, + "settings": { + "aliases": [{ + "type": "uri", + "alias": "registry", + "content": "https://wacli.ofs.lol" + }] + } +} + diff --git a/src/main.zig b/src/main.zig index c8a3f67..91dab80 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,24 +1,18 @@ const std = @import("std"); -pub fn main() !void { - // Prints to stderr (it's a shortcut based on `std.io.getStdErr()`) - std.debug.print("All your {s} are belong to us.\n", .{"codebase"}); +const OauthFlows = struct { implict: struct { authrizationUrl: []const u8, scopes: std.StringHashMap([]const u8) } }; - // stdout is for the actual output of your application, for example if you - // are implementing gzip, then only the compressed bytes should be sent to - // stdout, not any debugging messages. - const stdout_file = std.io.getStdOut().writer(); - var bw = std.io.bufferedWriter(stdout_file); - const stdout = bw.writer(); +const WellKnownSettings = struct { + contentType: []const u8 = "application/json", + headers: ?[]const ([]const u8), + aliases: ?[]const struct { aliases: union { string: []const u8, array: []const []const u8 }, type: enum { path, method, bin, uri }, description: ?[]const u16, content: ?[]const u8 }, + auth: ?struct { scheme: enum { basic, bearer, oauth2 }, tokenName: ?[]const u8, flows: ?OauthFlows }, +}; - try stdout.print("Run `zig build test` to run the tests.\n", .{}); +const WellKnownSchema = struct { api: ?[]const u8, registry: bool = false, manifests: ?std.StringHashMap(struct { path: []const u8 }), bin: ?[]const std.StringHashMap([]const u8), settings: WellKnownSettings }; - try bw.flush(); // don't forget to flush! -} +const UserSettings = struct { db_path: []const u8 = "$HOME/.cache/wacrd.bin", install_dir: []const u8 = "$HOME/.local/bin", uri_shemes: ?std.StringHashMap([]const u8) }; -test "simple test" { - var list = std.ArrayList(i32).init(std.testing.allocator); - defer list.deinit(); // try commenting this out and see if zig detects the memory leak! - try list.append(42); - try std.testing.expectEqual(@as(i32, 42), list.pop()); -} +pub fn main() !void {} + +test "spec" {}