refactor: replace :CP login with :CP credentials subcommand
Problem: :CP login was a poor API — no way to clear credentials without raw Lua, and the single command didn't scale to multiple operations. Solution: replace login with a :CP credentials subcommand following the same pattern as :CP cache. :CP credentials set [platform] prompts and saves; :CP credentials clear [platform] removes one or all platforms. Add cache.clear_credentials(), rename login.lua to credentials.lua, update parse/dispatch/tab-complete, and rewrite vimdoc accordingly.
This commit is contained in:
parent
3e0b7beabf
commit
a04702d87c
6 changed files with 88 additions and 32 deletions
|
|
@ -388,6 +388,18 @@ function M.set_credentials(platform, creds)
|
|||
M.save()
|
||||
end
|
||||
|
||||
---@param platform string?
|
||||
function M.clear_credentials(platform)
|
||||
if platform then
|
||||
if cache_data._credentials then
|
||||
cache_data._credentials[platform] = nil
|
||||
end
|
||||
else
|
||||
cache_data._credentials = nil
|
||||
end
|
||||
M.save()
|
||||
end
|
||||
|
||||
function M.clear_all()
|
||||
local creds = cache_data._credentials
|
||||
cache_data = {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue