table render

This commit is contained in:
Alexander Popov 2022-09-25 00:34:03 +03:00
parent 56373a75ee
commit 2a7a225024
Signed by: iiiypuk
GPG Key ID: D8C9B59A9F04A70C
2 changed files with 20 additions and 12 deletions

View File

@ -1,5 +1,5 @@
name: git-ahead-check
version: 0.2.0
version: 0.3.0
authors:
- Alexander Popov <iiiypuk@fastmail.fm>

View File

@ -26,18 +26,26 @@ if File.exists?(CONFIG_PATH)
sleep(600)
`notify-send --app-name=git-ahead-check --icon=flag-red --urgency=normal GIT-AHEAD "Unpushed repos: #{repositoryes.size}"`
else
repositoryes.each { |repo|
print "* #{repo[:ahead]}\t".colorize(:red).mode(:bold)
print repo[:name].colorize(:yellow)
repos_table = Tallboy.table do
header [
"Ahead".colorize.mode(:bold),
"Repo name".colorize.mode(:bold),
if !ARGV_VARS.short
"Repo path".colorize.mode(:bold)
end,
]
repositoryes.each { |repo|
row [
repo[:ahead].colorize(:red).mode(:bold),
repo[:name].colorize(:yellow),
if !ARGV_VARS.short
repo[:path].sub("$HOME", ENV["HOME"]).colorize(:light_magenta)
end,
]
}
end
if !ARGV_VARS.short
print " ["
print repo[:path].colorize(:light_magenta)
print "]"
end
}
puts
puts repos_table
end
else
Dir.mkdir_p(File.dirname(CONFIG_PATH))