refactor(credentials): rename set/clear to login/logout/clear (#291)

## Problem

The `set` and `clear` subcommands don't clearly convey their intent —
`set`
reads like a generic setter rather than an auth action, and `clear`
overloads
single-platform and all-platform semantics in one subcommand.

## Solution

Rename `set` to `login`, split `clear` into `logout` (per-platform,
defaults
to active) and `clear` (all platforms).

New API:
- `:CP credentials login [platform]` — prompt and save credentials
- `:CP credentials logout [platform]` — remove credentials for one
platform
- `:CP credentials clear` — remove all stored credentials
This commit is contained in:
Barrett Ruth 2026-03-04 12:53:37 -05:00 committed by GitHub
parent 18a60da2d8
commit 98ac0aa7a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 58 additions and 29 deletions

View file

@ -433,27 +433,29 @@ COMMANDS *cp-commands*
Cancel an active race countdown.
Credential Commands ~
:CP credentials set [platform]
:CP credentials login [platform]
Set or update stored credentials for a platform.
Always prompts for username and password,
overwriting any previously saved credentials.
If [platform] is omitted, uses the active platform.
Examples: >
:CP credentials set atcoder
:CP credentials set codeforces
:CP credentials login atcoder
:CP credentials login codeforces
<
:CP credentials clear [platform]
Remove stored credentials. Without [platform],
clears credentials for all platforms.
:CP credentials logout [platform]
Remove stored credentials for a platform.
If [platform] is omitted, uses the active platform.
Examples: >
:CP credentials clear atcoder
:CP credentials clear
:CP credentials logout atcoder
<
:CP credentials clear
Remove stored credentials for all platforms.
<
Submit Commands ~
:CP submit [--lang {language}]
Submit the current solution to the online
judge. Uses stored credentials (set via
:CP credentials set). Prompts on first use
:CP credentials login). Prompts on first use
if no credentials are saved.
--lang: Submit solution for a specific language.
@ -714,7 +716,7 @@ Example: Setting up and solving AtCoder contest ABC324
8. Submit solution: >
:CP submit
< Prompts for credentials on first use and submits to AtCoder.
< Uses stored credentials and submits to AtCoder.
==============================================================================
I/O VIEW *cp-io-view*
@ -968,13 +970,17 @@ 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 set [platform]
:CP credentials login [platform]
Set or update credentials for a platform. Always prompts for
username and password, overwriting any previously saved values.
Omit [platform] to use the currently active platform.
:CP credentials clear [platform]
Remove stored credentials. Without [platform], clears all platforms.
:CP credentials 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*
@ -983,7 +989,7 @@ Submit the current solution to the online judge.
:CP submit [--lang {language}]
Submit the current solution. Uses stored credentials (set via
:CP credentials set). Prompts on first use if no credentials
:CP credentials login). Prompts on first use if no credentials
are saved.
--lang: Override the language to submit.