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:
parent
1f0414de8e
commit
645417f86b
4 changed files with 28 additions and 15 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue