git-ahead-check/src/git-ahead-check.cr

19 lines
451 B
Crystal

require "colorize"
repos_dirs = [""]
def check_repo(repo_path : String)
repo_name = repo_path.split("/")[-1]
ahead_count = `git -C #{repo_path} status | grep -i "Your branch" | grep -Eo "[0-9]"`.chomp
if !ahead_count.empty?
print "* #{ahead_count}\t".colorize(:red).mode(:bold)
print repo_name.colorize(:yellow)
print " ["
print repo_path.colorize(:light_magenta)
puts "]"
end
end
repos_dirs.each { |x| check_repo(x) }