diff options
| author | Amirreza Askarpour <raskarpour@gmail.com> | 2021-05-11 12:50:57 +0430 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-11 10:20:57 +0200 |
| commit | 9fd242db260a63d8b788d1edbabd2d76a55a2d61 (patch) | |
| tree | 82a47db9b567a0be1acfb3ccee129b1ff53e0e6a /lua/telescope/actions/init.lua | |
| parent | c061c216bfe082384d542a487ce02e9aed6177df (diff) | |
feat: add git_stash picker (#800)
Diffstat (limited to 'lua/telescope/actions/init.lua')
| -rw-r--r-- | lua/telescope/actions/init.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lua/telescope/actions/init.lua b/lua/telescope/actions/init.lua index 1677e10..ea9ba4c 100644 --- a/lua/telescope/actions/init.lua +++ b/lua/telescope/actions/init.lua @@ -340,6 +340,23 @@ actions.git_create_branch = function(prompt_bufnr) end end +--- Applies an existing git stash +---@param prompt_bufnr number: The prompt bufnr +actions.git_apply_stash = function(prompt_bufnr) + local selection = action_state.get_selected_entry() + actions.close(prompt_bufnr) + local _, ret, stderr = utils.get_os_command_output({ 'git', 'stash', 'apply', '--index', selection.value }) + if ret == 0 then + print("applied: " .. selection.value) + else + print(string.format( + 'Error when applying: %s. Git returned: "%s"', + selection.value, + table.concat(stderr, ' ') + )) + end +end + --- Checkout an existing git branch ---@param prompt_bufnr number: The prompt bufnr actions.git_checkout = function(prompt_bufnr) |
