Add better cursor display management
This commit is contained in:
parent
7f9db265b4
commit
84615d228e
1 changed files with 9 additions and 2 deletions
|
@ -10,7 +10,6 @@ require 'tty-spinner'
|
||||||
require 'colorize'
|
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'
|
||||||
|
|
||||||
|
@ -19,6 +18,11 @@ class ListRepos < Thor
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def list(selector_str='')
|
||||||
|
trap 'SIGINT' do
|
||||||
|
system 'tput cnorm' # show cursor (fix)
|
||||||
|
exit! 130
|
||||||
|
end
|
||||||
basedir = options['root'] || '.'
|
basedir = options['root'] || '.'
|
||||||
projects = []
|
projects = []
|
||||||
spinner = TTY::Spinner.new(
|
spinner = TTY::Spinner.new(
|
||||||
|
@ -32,6 +36,7 @@ class ListRepos < Thor
|
||||||
|
|
||||||
## COLLECT
|
## COLLECT
|
||||||
spinner.auto_spin
|
spinner.auto_spin
|
||||||
|
system 'tput civis' # hide cursor (fix)
|
||||||
Find.find(basedir) do |path|
|
Find.find(basedir) do |path|
|
||||||
next unless path =~ %r{.*/.git/config$}
|
next unless path =~ %r{.*/.git/config$}
|
||||||
|
|
||||||
|
@ -46,6 +51,8 @@ class ListRepos < Thor
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
spinner.stop
|
spinner.stop
|
||||||
|
system 'tput cnorm' # show cursor (fix)
|
||||||
|
puts ''
|
||||||
|
|
||||||
## REDUCE
|
## REDUCE
|
||||||
projects_selected = projects.select do |vals|
|
projects_selected = projects.select do |vals|
|
||||||
|
|
Loading…
Reference in a new issue