Add support for colors
This commit is contained in:
parent
3fdc373eec
commit
7f9db265b4
1 changed files with 8 additions and 3 deletions
|
@ -7,13 +7,18 @@ require 'find'
|
||||||
require 'thor'
|
require 'thor'
|
||||||
require 'table_print'
|
require 'table_print'
|
||||||
require 'tty-spinner'
|
require 'tty-spinner'
|
||||||
|
require 'colorize'
|
||||||
|
|
||||||
class ListRepos < Thor
|
class ListRepos < Thor
|
||||||
|
|
||||||
desc 'list [SELECTOR]', 'List repositories'
|
desc 'list [SELECTOR]', 'List repositories'
|
||||||
method_option :root, type: :string, aliases: '-r'
|
method_option :root, type: :string, aliases: '-r'
|
||||||
|
|
||||||
def list(selector_str="")
|
def initialize(*args)
|
||||||
|
String.disable_colorization = true unless ENV['NO_COLOR'].nil?
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
basedir = options['root'] || '.'
|
basedir = options['root'] || '.'
|
||||||
projects = []
|
projects = []
|
||||||
spinner = TTY::Spinner.new(
|
spinner = TTY::Spinner.new(
|
||||||
|
@ -22,8 +27,8 @@ class ListRepos < Thor
|
||||||
)
|
)
|
||||||
|
|
||||||
selector = self.class.build_selector(selector_str)
|
selector = self.class.build_selector(selector_str)
|
||||||
selector_str2 = selector.map { |k, v| "#{k}=#{v}" }.join(' ')
|
selector_str2 = selector.map { |k, v| "#{k}=#{v.to_s.colorize(:yellow)}" }.join(' AND ')
|
||||||
puts "selector = #{selector_str2}"
|
puts "SELECTOR: #{selector_str2}"
|
||||||
|
|
||||||
## COLLECT
|
## COLLECT
|
||||||
spinner.auto_spin
|
spinner.auto_spin
|
||||||
|
|
Loading…
Reference in a new issue