Skip to content

Commit b4dce6f

Browse files
committed
Update README and other minor cleanups
1 parent 2260524 commit b4dce6f

File tree

5 files changed

+4
-42
lines changed

5 files changed

+4
-42
lines changed

Makefile

Lines changed: 0 additions & 11 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ In the true developer fashion, I started with one task to solve Advent of Code p
1818

1919
## Disclaimer
2020

21-
This plugin follows the automation guidelines on the `r/adventofcode` [community wiki](https://www.reddit.com/r/adventofcode/wiki/faqs/automation).
21+
This plugin follows the guidelines on the `r/adventofcode` [community wiki](https://www.reddit.com/r/adventofcode/wiki/faqs/automation).
2222

2323
Specifically:
2424

25-
- Outbound calls are throttled to every 5 minutes.
2625
- Once inputs are downloaded, they are cached locally.
2726
- If you suspect your input is corrupted, you can manually clear cache and request new input with `:AocClearCache`
2827
- The User-Agent header used in HTTP requests is set to me since I maintain this tool.

lua/aoc/api.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ local cfg = require "aoc.config"
66
---@class APIWrapper
77
local M = {}
88
M.session_id = nil
9-
M.user_agent = "github.com/csessh/aoc.nvim by csessh@hey.com"
9+
M.user_agent = "<github.com/csessh/aoc.nvim> by csessh@hey.com"
1010

1111
---@param day string|osdate
1212
---@param year string|osdate

lua/aoc/cache.lua

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,18 @@ M.write_to_cache = function(day, year, content)
5252
vim.api.nvim_err_writeln("Unable to write puzzle input to cache at " .. filename)
5353
else
5454
f:write(content)
55+
f:close()
5556
end
56-
57-
f:close()
5857
end
5958

6059
---Write puzzle input to user's cwd() or where they specify it otherwise
6160
---@param day string|osdate
6261
---@param year string|osdate
6362
---@param content string
6463
M.write_to_file = function(day, year, content)
65-
local filename = ""
64+
local filename = cfg.options.puzzle_input.alternative_filepath
6665
if cfg.options.puzzle_input.save_to_current_dir then
6766
filename = vim.uv.cwd() .. "/" .. cfg.options.puzzle_input.filename
68-
else
69-
filename = cfg.options.puzzle_input.alternative_filepath
7067
end
7168

7269
---@diagnostic disable-next-line: param-type-mismatch

lua/aoc/init.lua

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,6 @@ M.setup = function(args)
2727
api.save_puzzle_input(day, year)
2828
end, {})
2929

30-
vim.api.nvim_create_user_command("AocSubmitAnswer", function()
31-
local day = vim.fn.input "Day: "
32-
local year = vim.fn.input "Year: "
33-
local answer = vim.fn.input "Answer: "
34-
vim.api.nvim_out_write "\n"
35-
36-
day = utils.trim(day)
37-
year = utils.trim(year)
38-
answer = utils.trim(answer)
39-
40-
api.submit_answer(day, year, answer)
41-
end, {})
42-
43-
vim.api.nvim_create_user_command("AocSubmitTodayAnswer", function()
44-
local day = os.date "%d"
45-
local year = os.date "%Y"
46-
47-
local answer = vim.fn.input "Answer: "
48-
vim.api.nvim_out_write "\n"
49-
50-
api.submit_answer(day, year, answer)
51-
end, {})
52-
5330
vim.api.nvim_create_user_command("AocClearCache", cache.clear_cache, {})
5431
vim.api.nvim_create_user_command("AocInspectConfig", cfg.debug, {})
5532
end

0 commit comments

Comments
 (0)