ci: format
This commit is contained in:
parent
326e015f9b
commit
8b1f6b349f
2 changed files with 28 additions and 9 deletions
|
|
@ -55,13 +55,19 @@ function M.start(platform, contest_id, language)
|
|||
local start_time = cache.get_contest_start_time(platform, contest_id)
|
||||
|
||||
if not start_time then
|
||||
logger.log('Fetching contest list...', { level = vim.log.levels.INFO, override = true, sync = true })
|
||||
logger.log(
|
||||
'Fetching contest list...',
|
||||
{ level = vim.log.levels.INFO, override = true, sync = true }
|
||||
)
|
||||
local result = scraper.scrape_contest_list(platform)
|
||||
if result then
|
||||
local sc = result.supports_countdown
|
||||
if sc == false then
|
||||
cache.set_contest_summaries(platform, result.contests or {}, { supports_countdown = false })
|
||||
logger.log(('%s does not support :CP race'):format(display), { level = vim.log.levels.ERROR })
|
||||
logger.log(
|
||||
('%s does not support :CP race'):format(display),
|
||||
{ level = vim.log.levels.ERROR }
|
||||
)
|
||||
return
|
||||
end
|
||||
if result.contests and #result.contests > 0 then
|
||||
|
|
@ -121,10 +127,7 @@ function M.start(platform, contest_id, language)
|
|||
require('cp.setup').setup_contest(p, c, nil, l)
|
||||
else
|
||||
vim.notify(
|
||||
('[cp.nvim] %s starts in %s'):format(
|
||||
race_state.contest_name,
|
||||
format_countdown(r)
|
||||
),
|
||||
('[cp.nvim] %s starts in %s'):format(race_state.contest_name, format_countdown(r)),
|
||||
vim.log.levels.INFO
|
||||
)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -109,6 +109,9 @@ end, {
|
|||
end
|
||||
return filter_candidates(candidates)
|
||||
elseif args[2] == 'race' then
|
||||
if require('cp.race').status().active then
|
||||
return filter_candidates({ 'stop' })
|
||||
end
|
||||
local candidates = { 'stop' }
|
||||
vim.list_extend(candidates, platforms)
|
||||
return filter_candidates(candidates)
|
||||
|
|
@ -126,7 +129,11 @@ end, {
|
|||
if args[2] == 'stress' then
|
||||
local utils = require('cp.utils')
|
||||
return filter_candidates(utils.cwd_executables())
|
||||
elseif args[2] == 'race' and vim.tbl_contains(platforms, args[3]) then
|
||||
elseif
|
||||
args[2] == 'race'
|
||||
and not require('cp.race').status().active
|
||||
and vim.tbl_contains(platforms, args[3])
|
||||
then
|
||||
local cache = require('cp.cache')
|
||||
cache.load()
|
||||
local contests = cache.get_cached_contest_ids(args[3])
|
||||
|
|
@ -153,7 +160,11 @@ end, {
|
|||
return filter_candidates(candidates)
|
||||
end
|
||||
elseif num_args == 5 then
|
||||
if args[2] == 'race' and vim.tbl_contains(platforms, args[3]) then
|
||||
if
|
||||
args[2] == 'race'
|
||||
and not require('cp.race').status().active
|
||||
and vim.tbl_contains(platforms, args[3])
|
||||
then
|
||||
return filter_candidates({ '--lang' })
|
||||
elseif args[2] == 'cache' and args[3] == 'clear' and vim.tbl_contains(platforms, args[4]) then
|
||||
local cache = require('cp.cache')
|
||||
|
|
@ -168,7 +179,12 @@ end, {
|
|||
end
|
||||
end
|
||||
elseif num_args == 6 then
|
||||
if args[2] == 'race' and vim.tbl_contains(platforms, args[3]) and args[5] == '--lang' then
|
||||
if
|
||||
args[2] == 'race'
|
||||
and not require('cp.race').status().active
|
||||
and vim.tbl_contains(platforms, args[3])
|
||||
and args[5] == '--lang'
|
||||
then
|
||||
return filter_candidates(get_enabled_languages(args[3]))
|
||||
elseif vim.tbl_contains(platforms, args[2]) and args[5] == '--lang' then
|
||||
return filter_candidates(get_enabled_languages(args[2]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue