Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
savq committed Jan 31, 2023
1 parent bde780c commit 55ef3dd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .stylua.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
column_width = 120
column_width = 100
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 4
quote_style = "ForceDouble"
no_call_parentheses = false
call_parentheses = "NoSingleTable"
19 changes: 11 additions & 8 deletions lua/paq.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ local cfg = {
path = vim.fn.stdpath("data") .. "/site/pack/paqs/",
opt = false,
verbose = false,
url_format = 'https://github.com/%s.git'
url_format = "https://github.com/%s.git",
}
local logpath = vim.fn.has("nvim-0.8") == 1 and vim.fn.stdpath("log") or vim.fn.stdpath("cache")
local logfile = logpath .. "/paq.log"
local packages = {} -- 'name' = {options...} pairs
local packages = {} -- "name" = {options...} pairs

-- This is done only once. Doing it for every process seems overkill
local env = {}
local envfn = vim.fn.has('nvim-0.6') == 1 and uv.os_environ or vim.fn.environ -- compat
local envfn = vim.fn.has("nvim-0.6") == 1 and uv.os_environ or vim.fn.environ
for var, val in pairs(envfn()) do
table.insert(env, string.format("%s=%s", var, val))
end
Expand All @@ -36,7 +36,10 @@ local function report(op, name, res, n, total)
hook = { ok = "Ran hook for", err = "Failed to run hook for" },
}
local count = n and string.format(" [%d/%d]", n, total) or ""
vim.notify(string.format(" Paq:%s %s %s", count, messages[op][res], name), res == "err" and vim.log.levels.ERROR)
vim.notify(
string.format(" Paq:%s %s %s", count, messages[op][res], name),
res == "err" and vim.log.levels.ERROR
)
end

local function new_counter()
Expand All @@ -49,8 +52,8 @@ local function new_counter()
report(over_op or op, name, res, c.ok + c.nop, total)
end
end
local summary = (" Paq: %s complete. %d ok; %d errors;" .. (c.nop > 0 and " %d no-ops" or ""))
vim.notify(summary:format(op, c.ok, c.err, c.nop))
local summary = " Paq: %s complete. %d ok; %d errors;" .. (c.nop > 0 and " %d no-ops" or "")
vim.notify(string.format(summary, op, c.ok, c.err, c.nop))
vim.cmd("packloadall! | silent! helptags ALL")
vim.cmd("doautocmd User PaqDone" .. op:gsub("^%l", string.upper))
return true
Expand Down Expand Up @@ -197,7 +200,7 @@ end
local function find_unlisted()
local unlisted = {}
-- TODO(breaking): Replace with `vim.fs.dir`
for _, packdir in pairs({ "start", "opt" }) do
for _, packdir in pairs { "start", "opt" } do
local path = cfg.path .. packdir
local handle = uv.fs_scandir(path)
while handle do
Expand Down Expand Up @@ -245,7 +248,7 @@ local function list()
table.sort(installed, sort_by_name)
table.sort(removed, sort_by_name)
local markers = { installed = "+", updated = "*" }
for header, pkgs in pairs({ ["Installed packages:"] = installed, ["Recently removed:"] = removed }) do
for header, pkgs in pairs { ["Installed packages:"] = installed, ["Recently removed:"] = removed } do
if #pkgs ~= 0 then
print(header)
for _, pkg in ipairs(pkgs) do
Expand Down

0 comments on commit 55ef3dd

Please sign in to comment.