Class: N2B::CLI
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(args) ⇒ CLI
constructor
A new instance of CLI.
Methods inherited from Base
config_file, #get_config, history_file, #load_config, test_environment?
Constructor Details
#initialize(args) ⇒ CLI
Returns a new instance of CLI.
7 8 9 10 |
# File 'lib/n2b/cli.rb', line 7 def initialize(args) @args = args = end |
Class Method Details
.run(args) ⇒ Object
3 4 5 |
# File 'lib/n2b/cli.rb', line 3 def self.run(args) new(args).execute end |
Instance Method Details
#execute ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/n2b/cli.rb', line 12 def execute # Pass advanced_config flag to get_config config = get_config(reconfigure: [:config], advanced_flow: [:advanced_config]) user_input = @args.join(' ') # All remaining args form user input/prompt addition # Diff functionality has been removed from N2B::CLI # if @options[:diff] # handle_diff_analysis(config) # els if user_input.empty? # No input text after options # If config mode was chosen, it's handled by get_config. # If not, and no input, prompt for it. unless [:config] # Don't prompt if only -c or --advanced-config was used puts "Enter your natural language command (or type 'exit' or 'quit'):" input_text = $stdin.gets.chomp exit if ['exit', 'quit'].include?(input_text.downcase) process_natural_language_command(input_text, config) end else # Natural language command provided as argument process_natural_language_command(user_input, config) end end |