fix(ci): format
This commit is contained in:
parent
27bae07035
commit
a5b4479e2a
2 changed files with 16 additions and 13 deletions
|
|
@ -62,7 +62,11 @@ M.defaults = {
|
||||||
setup_code = nil,
|
setup_code = nil,
|
||||||
},
|
},
|
||||||
debug = false,
|
debug = false,
|
||||||
scrapers = vim.iter(constants.PLATFORMS):map(function(platform) return platform, true end):totable(),
|
scrapers = vim.iter(constants.PLATFORMS)
|
||||||
|
:map(function(platform)
|
||||||
|
return platform, true
|
||||||
|
end)
|
||||||
|
:totable(),
|
||||||
tile = nil,
|
tile = nil,
|
||||||
filename = nil,
|
filename = nil,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -579,17 +579,16 @@ local function parse_command(args)
|
||||||
cache.load()
|
cache.load()
|
||||||
local contest_data = cache.get_contest_data(state.platform, state.contest_id)
|
local contest_data = cache.get_contest_data(state.platform, state.contest_id)
|
||||||
if contest_data and contest_data.problems then
|
if contest_data and contest_data.problems then
|
||||||
local problem_ids = vim.tbl_map(function(prob) return prob.id end, contest_data.problems)
|
local problem_ids = vim.tbl_map(function(prob)
|
||||||
|
return prob.id
|
||||||
|
end, contest_data.problems)
|
||||||
if vim.tbl_contains(problem_ids, first) then
|
if vim.tbl_contains(problem_ids, first) then
|
||||||
return { type = "problem_switch", problem = first, language = language }
|
return { type = "problem_switch", problem = first, language = language }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return {
|
return {
|
||||||
type = "error",
|
type = "error",
|
||||||
message = ("Invalid command '%s'. Valid actions: [%s] or valid problem IDs from contest"):format(
|
message = ("invalid subcommand '%s'"):format(first),
|
||||||
first,
|
|
||||||
table.concat(actions, ", ")
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -663,24 +662,24 @@ function M.handle_command(opts)
|
||||||
logger.log(
|
logger.log(
|
||||||
("loaded %d problems for %s %s"):format(#metadata_result.problems, cmd.platform, cmd.contest)
|
("loaded %d problems for %s %s"):format(#metadata_result.problems, cmd.platform, cmd.contest)
|
||||||
)
|
)
|
||||||
problem_ids = vim.tbl_map(function(prob) return prob.id end, metadata_result.problems)
|
problem_ids = vim.tbl_map(function(prob)
|
||||||
|
return prob.id
|
||||||
|
end, metadata_result.problems)
|
||||||
has_metadata = true
|
has_metadata = true
|
||||||
else
|
else
|
||||||
cache.load()
|
cache.load()
|
||||||
local contest_data = cache.get_contest_data(cmd.platform, cmd.contest)
|
local contest_data = cache.get_contest_data(cmd.platform, cmd.contest)
|
||||||
if contest_data and contest_data.problems then
|
if contest_data and contest_data.problems then
|
||||||
problem_ids = vim.tbl_map(function(prob) return prob.id end, contest_data.problems)
|
problem_ids = vim.tbl_map(function(prob)
|
||||||
|
return prob.id
|
||||||
|
end, contest_data.problems)
|
||||||
has_metadata = true
|
has_metadata = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if has_metadata and not vim.tbl_contains(problem_ids, cmd.problem) then
|
if has_metadata and not vim.tbl_contains(problem_ids, cmd.problem) then
|
||||||
logger.log(
|
logger.log(
|
||||||
("Invalid problem '%s' for contest %s %s"):format(
|
("Invalid problem '%s' for contest %s %s"):format(cmd.problem, cmd.platform, cmd.contest),
|
||||||
cmd.problem,
|
|
||||||
cmd.platform,
|
|
||||||
cmd.contest
|
|
||||||
),
|
|
||||||
vim.log.levels.ERROR
|
vim.log.levels.ERROR
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue