mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
feat(picker.git_diff): added staged flag
This commit is contained in:
parent
0a33aec0c6
commit
118648ce93
2 changed files with 4 additions and 0 deletions
|
|
@ -335,6 +335,7 @@ M.git_status = {
|
|||
|
||||
---@class snacks.picker.git.diff.Config: snacks.picker.git.Config
|
||||
---@field group? boolean group changes by file (when false, show individual hunks)
|
||||
---@field staged? boolean show staged changes
|
||||
---@field base? string base commit/branch/tag to diff against (default: HEAD)
|
||||
M.git_diff = {
|
||||
group = false,
|
||||
|
|
|
|||
|
|
@ -260,6 +260,9 @@ function M.diff(opts, ctx)
|
|||
if opts.base then
|
||||
vim.list_extend(args, { "--merge-base", opts.base })
|
||||
end
|
||||
if opts.staged then
|
||||
table.insert(args, "--cached")
|
||||
end
|
||||
return require("snacks.picker.source.diff").diff(
|
||||
ctx:opts({
|
||||
cmd = "git",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue