refactor(credentials): promote login/logout to top-level actions

Problem: :CP credentials login/logout/clear is verbose and inconsistent
with other actions that are all top-level (:CP run, :CP submit, etc.).
The clear-all subcommand is also unnecessary since re-logging in
overwrites existing credentials.

Solution: replace :CP credentials {login,logout,clear} with :CP login
[platform] and :CP logout [platform]. Remove the clear-all command and
the credentials subcommand dispatch — login/logout are now regular
actions routed through the standard action dispatcher.
This commit is contained in:
Barrett Ruth 2026-03-04 13:03:40 -05:00
parent 98ac0aa7a7
commit 29cb81eca2
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
5 changed files with 28 additions and 73 deletions

View file

@ -103,8 +103,8 @@ end, {
end
end
return filter_candidates(candidates)
elseif args[2] == 'credentials' then
return filter_candidates({ 'login', 'logout', 'clear' })
elseif args[2] == 'login' or args[2] == 'logout' then
return filter_candidates(platforms)
elseif args[2] == 'race' then
local candidates = { 'stop' }
vim.list_extend(candidates, platforms)
@ -126,8 +126,6 @@ end, {
cache.load()
local contests = cache.get_cached_contest_ids(args[3])
return filter_candidates(contests)
elseif args[2] == 'credentials' and vim.tbl_contains({ 'login', 'logout' }, args[3]) then
return filter_candidates(platforms)
elseif args[2] == 'cache' and args[3] == 'clear' then
local candidates = vim.list_extend({}, platforms)
table.insert(candidates, '')