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

@ -5,8 +5,9 @@ local logger = require('cp.log')
--- Dispatch `:CP pick` to appropriate picker
---@param language? string
---@param platform? string
---@return nil
function M.handle_pick_action(language)
function M.handle_pick_action(language, platform)
local config = config_module.get_config()
if not (config.ui and config.ui.picker) then
@ -54,7 +55,7 @@ function M.handle_pick_action(language)
picker = fzf_picker
end
picker.pick(language)
picker.pick(language, platform)
end
return M