0

I'm using zsh and zsh-git-prompt and its working great. When I'm inside a folder that is a git repository I receive notice about the git status:

thomas@linux-fopt ~Path/to/Git/repo(localDevelop|✚2)% 

Meaning, that I'm on the localDevelop branch and have modified two files.

Now, I would very much appreciate to get an overview like that for all folders in the current folder I am inside, something like:

$ lsGit
  FolderA (master|+1)     (<- is a git repo)
  FolderB (develop|+2)    (<- is a git repo)
  FolderC                 (<- is not a git repo)

Files inside the current folder should be ignore, only folders should be displayed.

Is there a way to realize this with zsh?

0

1 Answer 1

1

Is this good enough?

user@host:~$ cat git-ls.zsh
#!/bin/zsh

source ~/zsh-git-prompt/zshrc.sh

for d in *; do
  if [[ -d "$d" && -e "$d/.git" ]]; then
    echo "$d $(cd "$d" && git_super_status | sed -r 's/(%G|%\{|%\})//g')"
  else
    echo "$d"
  fi
done

user@host:~/dev/external$ ~/git-ls.zsh
1-example-file
ansible (devel|✚2…)
asciinema.org (master|✔)
boltons (master|✔)
caffeine (master|✔)
casperjs (:4225d4c|✔)
Chronicle-Queue (master|✔)
citus (master|✔)
citus-docker (master|✔)
coreutils (master|✔)
cpython
ctop (keyerror_cpuacct_stat|…)
^C

Edit: if you don't care about files see the first revision of this post.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .