init
This commit is contained in:
commit
c8d0aa91e9
15
.editorconfig
Normal file
15
.editorconfig
Normal 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
24
shard.yml
Normal 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
16
src/git-ahead-check.cr
Normal 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) }
|
Loading…
Reference in New Issue
Block a user