feat(picker): open contest picker directly from :CP <platform>

Problem: `:CP codechef` (platform with no contest) returned a "too few
arguments" error, forcing users to type `:CP pick` separately.

Solution: When a platform name is given with no contest, parse it as a
`pick` action with the platform pre-selected, skipping the platform
selection step in the picker UI.
This commit is contained in:
Barrett Ruth 2026-03-06 23:02:40 -05:00
parent 1f0414de8e
commit 645417f86b
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
4 changed files with 28 additions and 15 deletions

View file

@ -64,7 +64,14 @@ local function contest_picker(opts, platform, refresh, language)
:find()
end
function M.pick(language)
---@param language? string
---@param platform? string
function M.pick(language, platform)
if platform then
contest_picker({}, platform, false, language)
return
end
local opts = {}
local platforms = picker_utils.get_platforms()