lib/aia/main.rb in aia-0.5.8 vs lib/aia/main.rb in aia-0.5.9

- old
+ new

@@ -13,15 +13,19 @@ # Everything is being handled within the context # of a single class. class AIA::Main + SPINNER_FORMAT = :bouncing_ball + include AIA::DynamicContent include AIA::UserQuery attr_accessor :logger, :tools, :backend + attr_reader :spinner + def initialize(args= ARGV) AIA::Tools.load_tools AIA::Cli.new(args) @@ -29,10 +33,13 @@ debug_me('== CONFIG AFTER CLI =='){[ "AIA.config" ]} end + @spinner = TTY::Spinner.new(":spinner :title", format: SPINNER_FORMAT) + spinner.update(title: "composing response ... ") + @logger = AIA::Logging.new(AIA.config.log_file) @logger.info(AIA.config) if AIA.config.debug? || AIA.config.verbose? @prompt = AIA::Prompt.new.prompt @@ -116,11 +123,17 @@ end end def get_and_display_result(the_prompt_text) + spinner.auto_spin if AIA.config.verbose? + backend.text = the_prompt_text result = backend.run + + if AIA.config.verbose? + spinner.success "Done." + end AIA.config.out_file.write "\nResponse:\n" if STDOUT == AIA.config.out_file if AIA.config.render?