style: Improve readability (hide root directory in list)

This commit is contained in:
Glenn Y. Rolland 2022-08-17 18:51:13 +02:00
parent 3eb0d70f1a
commit 603037ae0b

View file

@ -40,7 +40,7 @@ class ListRepos < Thor
Find.find(basedir) do |path| Find.find(basedir) do |path|
next unless path =~ %r{.*/.git/config$} next unless path =~ %r{.*/.git/config$}
project_root = File.dirname(File.dirname(path)) project_root = File.dirname(File.dirname(path)).gsub(%r{^#{basedir}/}, '')
lines = File.readlines(path) lines = File.readlines(path)
projects << { projects << {
path: project_root, path: project_root,
@ -58,7 +58,7 @@ class ListRepos < Thor
## REDUCE ## REDUCE
projects_selected = projects.select do |vals| projects_selected = projects.select do |vals|
res = true res = true
selector.each do |k,v| selector.each do |k, v|
res &&= (vals[k] == v) res &&= (vals[k] == v)
end end
res res