From 73324a15aa524cf75deebc4172f5a1f0d0051bc6 Mon Sep 17 00:00:00 2001 From: t Date: Sat, 13 Jun 2026 12:09:00 -0600 Subject: auth: CLI auth manager + `panto auth` subcommands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add src/auth_manager.zig (turn-time resolution: load→login→refresh→exchange→ build credential, patch live config) and `panto auth status|login|logout` subcommands with a line-based device-code presenter. Add config_file.loadFromString. --- src/config_file.zig | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/config_file.zig') diff --git a/src/config_file.zig b/src/config_file.zig index 19e4bb1..1277661 100644 --- a/src/config_file.zig +++ b/src/config_file.zig @@ -398,6 +398,18 @@ pub fn userConfigPath(allocator: Allocator, environ_map: *const std.process.Envi return error.NoHomeDirectory; } +/// Resolve a `Config` from a single in-memory TOML string. Convenience for +/// tests and tooling that already hold the document text. +pub fn loadFromString( + allocator: Allocator, + environ_map: *const std.process.Environ.Map, + source: []const u8, +) Error!Config { + const doc = parseDoc(allocator, source) catch return error.InvalidConfigToml; + defer doc.deinit(); + return resolve(allocator, environ_map, doc.root); +} + /// Load from explicit layer paths, lowest precedence first. Useful for /// tests. Missing files are skipped. pub fn loadFromPaths( -- cgit v1.3