From 3eb0d70f1a3a7c97e48f511105e62726d92670a8 Mon Sep 17 00:00:00 2001 From: Glenn Date: Wed, 17 Aug 2022 18:50:35 +0200 Subject: [PATCH] feat: Add support for mr --- exe/collect-repos | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/exe/collect-repos b/exe/collect-repos index 7024b0d..eeebdd3 100755 --- a/exe/collect-repos +++ b/exe/collect-repos @@ -46,8 +46,9 @@ class ListRepos < Thor path: project_root, github: lines.select { |line| line =~ /github\.com/ }.any?, gitlab: lines.select { |line| line =~ /gitlab\.com/ }.any?, - bitbucket: lines.select { |line| line =~ /bitbucket\.com/ }.any?, - gitea_glenux: lines.select { |line| line =~ /code\.(dinlas\.)?apps\.glenux\.net/ }.any?, + bitbucket: lines.select { |line| line =~ /bitbucket\.(com|org)/ }.any?, + gitea: lines.select { |line| line =~ /code\.(dinlas\.)?apps\.glenux\.net/ }.any?, + mr: self.class.mr_enabled?(project_root, lines) } end spinner.stop @@ -67,7 +68,14 @@ class ListRepos < Thor # require 'pp' # pp projects_selected tp.set :max_width, 100 - tp projects_selected, :path, :github, :gitlab, :bitbucket, :gitea_glenux + + columns = [:path] + ([:github, :gitlab, :bitbucket, :gitea, :mr] - selector.keys) + tp projects_selected, *columns + end + + def self.mr_enabled?(project_root, _lines) + system "cd #{project_root} && mr status >/dev/null 2>&1" + $?.success? end def self.build_selector(str)