feat(commands): add :CP <platform> signup subcommand (#337)
## Problem No quick way to reach a platform's registration page from within Neovim. ## Solution Add `signup` as a platform subcommand that calls `vim.ui.open` on the platform's registration URL. URLs live in a new `SIGNUP_URLS` table in `constants.lua`. Works even when the platform is disabled. Tab completion and vimdoc updated.
This commit is contained in:
parent
e89c57558d
commit
4ef00afe66
2 changed files with 10 additions and 1 deletions
|
|
@ -25,6 +25,15 @@ M.PLATFORM_DISPLAY_NAMES = {
|
||||||
usaco = 'USACO',
|
usaco = 'USACO',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
M.SIGNUP_URLS = {
|
||||||
|
atcoder = 'https://atcoder.jp/register',
|
||||||
|
codechef = 'https://www.codechef.com/register',
|
||||||
|
codeforces = 'https://codeforces.com/register',
|
||||||
|
cses = 'https://cses.fi/register',
|
||||||
|
kattis = 'https://open.kattis.com/register',
|
||||||
|
usaco = 'https://usaco.org/index.php?page=createaccount',
|
||||||
|
}
|
||||||
|
|
||||||
M.CPP = 'cpp'
|
M.CPP = 'cpp'
|
||||||
M.PYTHON = 'python'
|
M.PYTHON = 'python'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ end, {
|
||||||
return filter_candidates(candidates)
|
return filter_candidates(candidates)
|
||||||
elseif num_args == 3 then
|
elseif num_args == 3 then
|
||||||
if vim.tbl_contains(platforms, args[2]) then
|
if vim.tbl_contains(platforms, args[2]) then
|
||||||
local candidates = { 'login', 'logout' }
|
local candidates = { 'login', 'logout', 'signup' }
|
||||||
local cache = require('cp.cache')
|
local cache = require('cp.cache')
|
||||||
cache.load()
|
cache.load()
|
||||||
vim.list_extend(candidates, cache.get_cached_contest_ids(args[2]))
|
vim.list_extend(candidates, cache.get_cached_contest_ids(args[2]))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue