feat: add :CP login command for explicit credential management

Problem: credentials were only set implicitly on first :CP submit.
There was no way to update wrong credentials, log out, or set
credentials ahead of time without editing the cache JSON manually.

Solution: add :CP login [platform] which always prompts for username
and password and overwrites any saved credentials for that platform.
Omitting the platform falls back to the active platform. Wire the
command through constants, parse_command, handle_command, and add
tab-completion (suggests platform names). Document in vimdoc under
the SUBMIT section and in the commands reference.
This commit is contained in:
Barrett Ruth 2026-03-03 16:26:48 -05:00 committed by Barrett Ruth
parent a08d1f0c5e
commit 3e0b7beabf
5 changed files with 66 additions and 4 deletions

View file

@ -83,6 +83,12 @@ local function parse_command(args)
else
return { type = 'action', action = 'interact' }
end
elseif first == 'login' then
return {
type = 'action',
action = 'login',
platform = args[2],
}
elseif first == 'stress' then
return {
type = 'action',
@ -317,6 +323,8 @@ function M.handle_command(opts)
edit.toggle_edit(cmd.test_index)
elseif cmd.action == 'stress' then
require('cp.stress').toggle(cmd.generator_cmd, cmd.brute_cmd)
elseif cmd.action == 'login' then
require('cp.login').login(cmd.platform)
elseif cmd.action == 'submit' then
require('cp.submit').submit({ language = cmd.language })
elseif cmd.action == 'race' then