mirror of
https://github.com/wfxr/forgit.git
synced 2026-09-15 17:56:17 -04:00
refactor: reformat
This commit is contained in:
parent
13ca262e67
commit
9a36f6ea5e
|
|
@ -147,6 +147,21 @@ forgit::clean() {
|
|||
echo 'Nothing to clean.'
|
||||
}
|
||||
|
||||
forgit::cherry::pick() {
|
||||
local base target preview opts
|
||||
base=$(git branch --show-current)
|
||||
[[ -z $1 ]] && echo "Please specify target branch" && return 1
|
||||
target="$1"
|
||||
preview="echo {1} | xargs -I% git show --color=always % | $forgit_show_pager"
|
||||
opts="
|
||||
$FORGIT_FZF_DEFAULT_OPTS
|
||||
-m -0
|
||||
"
|
||||
git cherry "$base" "$target" --abbrev -v | cut -d ' ' -f2- |
|
||||
FZF_DEFAULT_OPTS="$opts" fzf --preview="$preview" | cut -d' ' -f1 |
|
||||
xargs -I% git cherry-pick %
|
||||
}
|
||||
|
||||
# git ignore generator
|
||||
export FORGIT_GI_REPO_REMOTE=${FORGIT_GI_REPO_REMOTE:-https://github.com/dvcs/gitignore}
|
||||
export FORGIT_GI_REPO_LOCAL=${FORGIT_GI_REPO_LOCAL:-~/.forgit/gi/repos/dvcs/gitignore}
|
||||
|
|
@ -201,21 +216,6 @@ forgit::ignore::clean() {
|
|||
[[ -d "$FORGIT_GI_REPO_LOCAL" ]] && rm -rf "$FORGIT_GI_REPO_LOCAL"
|
||||
}
|
||||
|
||||
forgit::cherry::pick() {
|
||||
local base target preview opts
|
||||
base=$(git branch --show-current)
|
||||
[[ -z $1 ]] && echo "Please specify target branch" && return 1
|
||||
target="$1"
|
||||
preview="echo {1} | xargs -I% git show --color=always % | $forgit_show_pager"
|
||||
opts="
|
||||
$FORGIT_FZF_DEFAULT_OPTS
|
||||
-m -0
|
||||
"
|
||||
git cherry "$base" "$target" --abbrev -v | cut -d ' ' -f2- |
|
||||
FZF_DEFAULT_OPTS="$opts" fzf --preview="$preview" | cut -d' ' -f1 |
|
||||
xargs -I% git cherry-pick %
|
||||
}
|
||||
|
||||
FORGIT_FZF_DEFAULT_OPTS="
|
||||
$FZF_DEFAULT_OPTS
|
||||
--ansi
|
||||
|
|
|
|||
Loading…
Reference in a new issue