This commit is contained in:
Alexander Popov 2022-08-11 01:37:24 +03:00
commit c8d0aa91e9
Signed by: iiiypuk
GPG Key ID: D8C9B59A9F04A70C
3 changed files with 55 additions and 0 deletions

15
.editorconfig Normal file
View File

@ -0,0 +1,15 @@
root = true
# for all projects
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
# Crystal
[*.cr]
indent_style = space
indent_size = 2

24
shard.yml Normal file
View File

@ -0,0 +1,24 @@
name: git-ahead-check
version: 0.1.0
# authors:
# - name <email@example.com>
# description: |
# Short description of git-ahead-check
# dependencies:
# pg:
# github: will/crystal-pg
# version: "~> 0.5"
# development_dependencies:
# webmock:
# github: manastech/webmock.cr
# license: MIT
targets:
git-ahead-check:
main: src/git-ahead-check.cr

16
src/git-ahead-check.cr Normal file
View File

@ -0,0 +1,16 @@
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]"`
if !ahead_count.empty?
print repo_name.colorize(:yellow)
print " " * (25 - repo_name.size)
print ahead_count.to_s.colorize(:green).mode(:bold)
end
end
repos_dirs.each { |x| check_repo(x) }