diff --git a/shard.yml b/shard.yml index 557298b..518e92f 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: git-ahead-check -version: 0.2.0 +version: 0.3.0 authors: - Alexander Popov diff --git a/src/git-ahead-check.cr b/src/git-ahead-check.cr index e64a90d..520808f 100644 --- a/src/git-ahead-check.cr +++ b/src/git-ahead-check.cr @@ -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))