feat: improve UX with vim.notify (#1763)

* fix(notify): don't report request on new line

* ref(notify): update message format

* ref(msgs): always quote values + decrease duplication

* fix(ci): undefined variables

* ref(actions): temporary silent actions.__index errors

* cleanup

* revert: panic effort, we continue to use error for those

Co-authored-by: Simon Hauser <Simon-Hauser@outlook.de>
This commit is contained in:
tami5
2022-03-13 20:11:27 +03:00
committed by GitHub
parent 75b5730432
commit ef7b6ada6d
17 changed files with 311 additions and 116 deletions

View File

@@ -15,13 +15,21 @@ local git = {}
git.files = function(opts)
if opts.is_bare then
error "This operation must be run in a work tree"
utils.notify("builtin.git_files", {
msg = "This operation must be run in a work tree",
level = "ERROR",
})
return
end
local show_untracked = utils.get_default(opts.show_untracked, true)
local recurse_submodules = utils.get_default(opts.recurse_submodules, false)
if show_untracked and recurse_submodules then
error "Git does not support both --others and --recurse-submodules"
utils.notify("builtin.git_files", {
msg = "Git does not support both --others and --recurse-submodules",
level = "ERROR",
})
return
end
-- By creating the entry maker after the cwd options,
@@ -300,7 +308,11 @@ end
git.status = function(opts)
if opts.is_bare then
error "This operation must be run in a work tree"
utils.notify("builtin.git_status", {
msg = "This operation must be run in a work tree",
level = "ERROR",
})
return
end
local gen_new_finder = function()
@@ -308,13 +320,17 @@ git.status = function(opts)
local git_cmd = { "git", "status", "-s", "--", "." }
if expand_dir then
table.insert(git_cmd, table.getn(git_cmd) - 1, "-u")
table.insert(git_cmd, #git_cmd - 1, "-u")
end
local output = utils.get_os_command_output(git_cmd, opts.cwd)
if table.getn(output) == 0 then
if #output == 0 then
print "No changes found"
utils.notify("builtin.git_status", {
msg = "No changes found",
level = "WARN",
})
return
end