Skip to content

Commit 634d234

Browse files
t-bgitster
authored andcommitted
completion: add git status
Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 7c599e9 commit 634d234

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

contrib/completion/git-completion.bash

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,6 +1825,56 @@ _git_stage ()
18251825
_git_add
18261826
}
18271827

1828+
_git_status ()
1829+
{
1830+
local complete_opt
1831+
local untracked_state
1832+
1833+
case "$cur" in
1834+
--ignore-submodules=*)
1835+
__gitcomp "none untracked dirty all" "" "${cur##--ignore-submodules=}"
1836+
return
1837+
;;
1838+
--untracked-files=*)
1839+
__gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"
1840+
return
1841+
;;
1842+
--column=*)
1843+
__gitcomp "
1844+
always never auto column row plain dense nodense
1845+
" "" "${cur##--column=}"
1846+
return
1847+
;;
1848+
--*)
1849+
__gitcomp "
1850+
--short --branch --porcelain --long --verbose
1851+
--untracked-files= --ignore-submodules= --ignored
1852+
--column= --no-column
1853+
"
1854+
return
1855+
;;
1856+
esac
1857+
1858+
untracked_state="$(__git_get_option_value "-u" "--untracked-files=" \
1859+
"$__git_untracked_file_modes" "status.showUntrackedFiles")"
1860+
1861+
case "$untracked_state" in
1862+
no)
1863+
# --ignored option does not matter
1864+
complete_opt=
1865+
;;
1866+
all|normal|*)
1867+
complete_opt="--cached --directory --no-empty-directory --others"
1868+
1869+
if [ -n "$(__git_find_on_cmdline "--ignored")" ]; then
1870+
complete_opt="$complete_opt --ignored --exclude=*"
1871+
fi
1872+
;;
1873+
esac
1874+
1875+
__git_complete_index_file "$complete_opt"
1876+
}
1877+
18281878
__git_config_get_set_variables ()
18291879
{
18301880
local prevword word config_file= c=$cword

0 commit comments

Comments
 (0)