From 0d06d5cb8965c18b99c53fc4f887a0ed2845ca98 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 7 Mar 2026 19:50:34 -0500 Subject: [PATCH] refactor(credentials): add `cp.Credentials` LuaCATS class --- lua/cp/git_credential.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lua/cp/git_credential.lua b/lua/cp/git_credential.lua index c6dfc39..4ef0700 100644 --- a/lua/cp/git_credential.lua +++ b/lua/cp/git_credential.lua @@ -1,3 +1,8 @@ +---@class cp.Credentials +---@field username string +---@field password string +---@field token? string + local M = {} local HOSTS = { @@ -53,7 +58,7 @@ local function _parse_output(stdout) end ---@param platform string ----@return { username: string, password: string, token?: string }? +---@return cp.Credentials? function M.get(platform) local host = HOSTS[platform] if not host then @@ -92,7 +97,7 @@ function M.get(platform) end ---@param platform string ----@param creds { username: string, password: string, token?: string } +---@param creds cp.Credentials function M.store(platform, creds) local host = HOSTS[platform] if not host then @@ -110,7 +115,7 @@ function M.store(platform, creds) end ---@param platform string ----@param creds { username: string, password: string, token?: string } +---@param creds cp.Credentials function M.reject(platform, creds) local host = HOSTS[platform] if not host or not creds then