From 84615d228ee96affc402c6531cafe09fc8ca6a0c Mon Sep 17 00:00:00 2001 From: Glenn Date: Wed, 17 Aug 2022 18:50:03 +0200 Subject: [PATCH] Add better cursor display management --- exe/collect-repos | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/exe/collect-repos b/exe/collect-repos index 50d0f47..7024b0d 100755 --- a/exe/collect-repos +++ b/exe/collect-repos @@ -10,7 +10,6 @@ require 'tty-spinner' require 'colorize' class ListRepos < Thor - desc 'list [SELECTOR]', 'List repositories' method_option :root, type: :string, aliases: '-r' @@ -19,10 +18,15 @@ class ListRepos < Thor super end + def list(selector_str='') + trap 'SIGINT' do + system 'tput cnorm' # show cursor (fix) + exit! 130 + end basedir = options['root'] || '.' projects = [] spinner = TTY::Spinner.new( - hide_cursor: true, + hide_cursor: true, clear: true ) @@ -32,6 +36,7 @@ class ListRepos < Thor ## COLLECT spinner.auto_spin + system 'tput civis' # hide cursor (fix) Find.find(basedir) do |path| next unless path =~ %r{.*/.git/config$} @@ -46,6 +51,8 @@ class ListRepos < Thor } end spinner.stop + system 'tput cnorm' # show cursor (fix) + puts '' ## REDUCE projects_selected = projects.select do |vals|