Add files as arguments

Add case where "ga" command can accept files as arguments
that will be passed directly to "git add" bypassing fzf.
This commit is contained in:
Carlos de Paula 2020-01-13 19:42:52 -03:00 committed by Wenxuan
parent c954a1c92c
commit 0c6199b8cd
2 changed files with 12 additions and 0 deletions

View file

@ -76,6 +76,12 @@ end
# git add selector
function forgit::add
forgit::inside_work_tree || return 1
# Add files if passed as arguments
if not count $argv > /dev/null
git add $argv
return
end
set changed (git config --get-color color.status.changed red)
set unmerged (git config --get-color color.status.unmerged red)
set untracked (git config --get-color color.status.untracked red)

View file

@ -52,6 +52,12 @@ forgit::diff() {
forgit::add() {
forgit::inside_work_tree || return 1
local changed unmerged untracked files opts
# Add files if passed as arguments
[[ $# -ne 0 ]] && {
git add $@
return
}
changed=$(git config --get-color color.status.changed red)
unmerged=$(git config --get-color color.status.unmerged red)
untracked=$(git config --get-color color.status.untracked red)