From 2737a397bbb4b322896276ab2010cc29e383e974 Mon Sep 17 00:00:00 2001 From: sandroid Date: Sat, 31 Aug 2024 00:05:21 +0200 Subject: [PATCH] Add bash and fish completions --- completions/git-forgit.bash | 4 ++++ completions/git-forgit.fish | 6 ++++-- conf.d/forgit.plugin.fish | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/completions/git-forgit.bash b/completions/git-forgit.bash index 43d0a99..9f500a8 100755 --- a/completions/git-forgit.bash +++ b/completions/git-forgit.bash @@ -71,6 +71,7 @@ _git_forgit() fixup ignore log + reflog rebase reset_head revert_commit @@ -96,6 +97,7 @@ _git_forgit() diff) _git_diff ;; fixup) _git_branch ;; log) _git_log ;; + reflog) _git_reflog ;; rebase) _git_rebase ;; reset_head) _git_reset ;; revert_commit) _git_revert ;; @@ -129,6 +131,7 @@ then __git_complete forgit::diff _git_diff __git_complete forgit::fixup _git_branch __git_complete forgit::log _git_log + __git_complete forgit::reflog _git_reflog __git_complete forgit::rebase _git_rebase __git_complete forgit::reset::head _git_reset __git_complete forgit::revert::commit _git_revert @@ -147,6 +150,7 @@ then __git_complete "${forgit_diff}" _git_diff __git_complete "${forgit_fixup}" _git_branch __git_complete "${forgit_log}" _git_log + __git_complete "${forgit_reflog}" _git_reflog __git_complete "${forgit_rebase}" _git_rebase __git_complete "${forgit_reset_head}" _git_reset __git_complete "${forgit_revert_commit}" _git_revert diff --git a/completions/git-forgit.fish b/completions/git-forgit.fish index aa787bf..72c896b 100644 --- a/completions/git-forgit.fish +++ b/completions/git-forgit.fish @@ -7,8 +7,8 @@ function __fish_forgit_needs_subcommand for subcmd in add blame branch_delete checkout_branch checkout_commit checkout_file checkout_tag \ - cherry_pick cherry_pick_from_branch clean diff fixup ignore log rebase reset_head revert_commit \ - stash_show stash_push + cherry_pick cherry_pick_from_branch clean diff fixup ignore log reflog rebase reset_head \ + revert_commit stash_show stash_push if contains -- $subcmd (commandline -opc) return 1 end @@ -36,6 +36,7 @@ complete -c git-forgit -n __fish_forgit_needs_subcommand -a diff -d 'git diff vi complete -c git-forgit -n __fish_forgit_needs_subcommand -a fixup -d 'git fixup' complete -c git-forgit -n __fish_forgit_needs_subcommand -a ignore -d 'git ignore generator' complete -c git-forgit -n __fish_forgit_needs_subcommand -a log -d 'git commit viewer' +complete -c git-forgit -n __fish_forgit_needs_subcommand -a reflog -d 'git reflog viewer' complete -c git-forgit -n __fish_forgit_needs_subcommand -a rebase -d 'git rebase' complete -c git-forgit -n __fish_forgit_needs_subcommand -a reset_head -d 'git reset HEAD (unstage) selector' complete -c git-forgit -n __fish_forgit_needs_subcommand -a revert_commit -d 'git revert commit selector' @@ -52,6 +53,7 @@ complete -c git-forgit -n '__fish_seen_subcommand_from cherry_pick' -a "(complet complete -c git-forgit -n '__fish_seen_subcommand_from clean' -a "(__fish_git_files untracked ignored)" complete -c git-forgit -n '__fish_seen_subcommand_from fixup' -a "(__fish_git_local_branches)" complete -c git-forgit -n '__fish_seen_subcommand_from log' -a "(complete -C 'git log ')" +complete -c git-forgit -n '__fish_seen_subcommand_from reflog' -a "(complete -C 'git reflog ')" complete -c git-forgit -n '__fish_seen_subcommand_from rebase' -a "(complete -C 'git rebase ')" complete -c git-forgit -n '__fish_seen_subcommand_from reset_head' -a "(__fish_git_files all-staged)" complete -c git-forgit -n '__fish_seen_subcommand_from revert_commit' -a "(__fish_git_commits)" diff --git a/conf.d/forgit.plugin.fish b/conf.d/forgit.plugin.fish index 98d6578..18761d0 100644 --- a/conf.d/forgit.plugin.fish +++ b/conf.d/forgit.plugin.fish @@ -35,6 +35,7 @@ if test -z "$FORGIT_NO_ALIASES" abbr -a -- (string collect $forgit_add; or string collect "ga") git-forgit add abbr -a -- (string collect $forgit_reset_head; or string collect "grh") git-forgit reset_head abbr -a -- (string collect $forgit_log; or string collect "glo") git-forgit log + abbr -a -- (string collect $forgit_reflog; or string collect "grl") git-forgit reflog abbr -a -- (string collect $forgit_diff; or string collect "gd") git-forgit diff abbr -a -- (string collect $forgit_ignore; or string collect "gi") git-forgit ignore abbr -a -- (string collect $forgit_checkout_file; or string collect "gcf") git-forgit checkout_file