mirror of
https://github.com/wfxr/forgit.git
synced 2026-09-10 07:16:23 -04:00
Moved to new argument names version of arg parsing
This commit is contained in:
parent
58ae7dce87
commit
74724a80cb
|
|
@ -57,7 +57,7 @@ function forgit::log -d "git commit viewer"
|
||||||
end
|
end
|
||||||
|
|
||||||
## git diff viewer
|
## git diff viewer
|
||||||
function forgit::diff -d "git diff viewer"
|
function forgit::diff -d "git diff viewer"
|
||||||
forgit::inside_work_tree || return 1
|
forgit::inside_work_tree || return 1
|
||||||
if count $argv > /dev/null
|
if count $argv > /dev/null
|
||||||
if git rev-parse "$1" > /dev/null 2>&1
|
if git rev-parse "$1" > /dev/null 2>&1
|
||||||
|
|
@ -167,12 +167,13 @@ function forgit::checkout::file -d "git checkout-file selector"
|
||||||
echo 'Nothing to restore.'
|
echo 'Nothing to restore.'
|
||||||
end
|
end
|
||||||
|
|
||||||
function forgit::checkout::branch -d "git checkout branch selector"
|
function forgit::checkout::branch -d "git checkout branch selector" --argument-names 'branch_name'
|
||||||
forgit::inside_work_tree || return 1
|
forgit::inside_work_tree || return 1
|
||||||
|
|
||||||
if count $argv > /dev/null
|
if test -n "$branch_name"
|
||||||
git checkout -b $argv[1]
|
git checkout -b "$branch_name"
|
||||||
git status --short
|
git status --short
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
set cmd "git branch --color=always --verbose --all --format=\"%(if:equals=HEAD)%(refname:strip=3)%(then)%(else)%(refname:short)%(end)\" $argv $forgit_emojify | sed '/^\$/d'"
|
set cmd "git branch --color=always --verbose --all --format=\"%(if:equals=HEAD)%(refname:strip=3)%(then)%(else)%(refname:short)%(end)\" $argv $forgit_emojify | sed '/^\$/d'"
|
||||||
|
|
@ -220,14 +221,13 @@ function forgit::clean -d "git clean selector"
|
||||||
echo 'Nothing to clean.'
|
echo 'Nothing to clean.'
|
||||||
end
|
end
|
||||||
|
|
||||||
function forgit::cherry::pick -d "git cherry-picking"
|
function forgit::cherry::pick -d "git cherry-picking" --argument-names 'target'
|
||||||
forgit::inside_work_tree || return 1
|
forgit::inside_work_tree || return 1
|
||||||
set base (git branch --show-current)
|
set base (git branch --show-current)
|
||||||
if not count $argv > /dev/null
|
if test -n "$target"
|
||||||
echo "Please specify target branch"
|
echo "Please specify target branch"
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
set target $argv[1]
|
|
||||||
set preview "echo {1} | xargs -I% git show --color=always % | $forgit_show_pager"
|
set preview "echo {1} | xargs -I% git show --color=always % | $forgit_show_pager"
|
||||||
set opts "
|
set opts "
|
||||||
$FORGIT_FZF_DEFAULT_OPTS
|
$FORGIT_FZF_DEFAULT_OPTS
|
||||||
|
|
@ -241,7 +241,7 @@ function forgit::cherry::pick -d "git cherry-picking"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function forgit::rebase -d "git rebase "
|
function forgit::rebase -d "git rebase"
|
||||||
forgit::inside_work_tree || return 1
|
forgit::inside_work_tree || return 1
|
||||||
|
|
||||||
if set -q FORGIT_LOG_GRAPH_ENABLE
|
if set -q FORGIT_LOG_GRAPH_ENABLE
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ forgit::checkout::branch() {
|
||||||
forgit::inside_work_tree || return 1
|
forgit::inside_work_tree || return 1
|
||||||
[[ $# -ne 0 ]] && { git checkout -b "$*"; return $?; }
|
[[ $# -ne 0 ]] && { git checkout -b "$*"; return $?; }
|
||||||
local cmd preview opts
|
local cmd preview opts
|
||||||
cmd="git branch --color=always --verbose --all --format=\"%(if:equals=HEAD)%(refname:strip=3)%(then)%(else)%(refname:short)%(end)\" $* $forgit_emojify | sed '/^$/d'"
|
cmd="git branch --color=always --verbose --all --format=\"%(if:equals=HEAD)%(refname:strip=3)%(then)%(else)%(refname:short)%(end)\" $forgit_emojify | sed '/^$/d'"
|
||||||
preview="git log {} --graph --pretty=format:'%C(auto)%h%d %s %C(black)%C(bold)%cr%Creset' --color=always --abbrev-commit --date=relative"
|
preview="git log {} --graph --pretty=format:'%C(auto)%h%d %s %C(black)%C(bold)%cr%Creset' --color=always --abbrev-commit --date=relative"
|
||||||
opts="
|
opts="
|
||||||
$FORGIT_FZF_DEFAULT_OPTS
|
$FORGIT_FZF_DEFAULT_OPTS
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue