dots status should correctly detect the status of a package that isn't a Git repo
This commit is contained in:
parent
82d27231b1
commit
c74b8ba141
1 changed files with 5 additions and 2 deletions
|
@ -69,12 +69,15 @@ status() {
|
|||
local -a packages
|
||||
packages=($argv)
|
||||
(( $#packages == 0 )) && packages=( $DOTFILES/*(N:t) )
|
||||
local length=${#${(O@)packages//?/X}[1]}
|
||||
local length=${#${(O@)packages//?/X}[1]} git_status
|
||||
cd $DOTFILES
|
||||
for p in $packages; do
|
||||
pushd $p
|
||||
printf "%${length}s " $p
|
||||
if [[ -z "$(command git status --porcelain --ignore-submodules -unormal)" ]]; then
|
||||
git_status="$(command git status --porcelain --ignore-submodules -unormal 2>/dev/null)"
|
||||
if (( $? != 0 )); then
|
||||
print -P "%F{247}not a git repository%f"
|
||||
elif [[ -z $git_status ]]; then
|
||||
print -P "%F{green}clean%f"
|
||||
else
|
||||
print -P "%F{red}unclean%f"
|
||||
|
|
Loading…
Reference in a new issue