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

## 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:09:32 -05:00 committed by GitHub
parent 98ac0aa7a7
commit 49e0ae3885
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 28 additions and 73 deletions

View file

@ -433,30 +433,27 @@ COMMANDS *cp-commands*
Cancel an active race countdown.
Credential Commands ~
:CP credentials login [platform]
:CP login [platform]
Set or update stored credentials for a platform.
Always prompts for username and password,
overwriting any previously saved credentials.
Prompts for username and password, overwriting
any previously saved credentials.
If [platform] is omitted, uses the active platform.
Examples: >
:CP credentials login atcoder
:CP credentials login codeforces
:CP login atcoder
:CP login codeforces
<
:CP credentials logout [platform]
:CP logout [platform]
Remove stored credentials for a platform.
If [platform] is omitted, uses the active platform.
Examples: >
:CP credentials logout atcoder
<
:CP credentials clear
Remove stored credentials for all platforms.
:CP logout atcoder
<
Submit Commands ~
:CP submit [--lang {language}]
Submit the current solution to the online
judge. Uses stored credentials (set via
:CP credentials login). Prompts on first use
if no credentials are saved.
:CP login). Prompts on first use if no
credentials are saved.
--lang: Submit solution for a specific language.
State Restoration ~
@ -963,34 +960,30 @@ Count down to a contest's start time and automatically run setup at T=0.
Statusline integration: see |cp-race-status|.
==============================================================================
CREDENTIALS *cp-credentials*
CREDENTIALS *cp-credentials*
Manage stored login credentials for platform submission.
Credentials are stored under _credentials in the main cache file
(stdpath('data')/cp-nvim.json). Use :CP cache read to inspect them.
:CP credentials login [platform]
Set or update credentials for a platform. Always prompts for
username and password, overwriting any previously saved values.
:CP login [platform]
Set or update credentials for a platform. Prompts for username
and password, overwriting any previously saved values.
Omit [platform] to use the currently active platform.
:CP credentials logout [platform]
:CP logout [platform]
Remove stored credentials for a platform.
Omit [platform] to use the currently active platform.
:CP credentials clear
Remove stored credentials for all platforms.
==============================================================================
SUBMIT *cp-submit*
SUBMIT *cp-submit*
Submit the current solution to the online judge.
:CP submit [--lang {language}]
Submit the current solution. Uses stored credentials (set via
:CP credentials login). Prompts on first use if no credentials
are saved.
:CP login). Prompts on first use if no credentials are saved.
--lang: Override the language to submit.
Platform support: