Class: Cowrite::CLI
- Inherits:
-
Object
- Object
- Cowrite::CLI
- Defined in:
- lib/cowrite/cli.rb
Constant Summary collapse
- QUESTION_COLOR =
:blue
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #run(argv) ⇒ Object
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
12 13 14 15 16 17 18 19 20 |
# File 'lib/cowrite/cli.rb', line 12 def initialize super # get config first so we fail fast api_key = ENV.fetch("COWRITE_API_KEY") url = ENV.fetch("COWRITE_URL", "https://api.openai.com") model = ENV.fetch("MODEL", "gpt-4o") @cowrite = Cowrite.new(url:, api_key:, model:) end |
Instance Method Details
#run(argv) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cowrite/cli.rb', line 22 def run(argv) prompt, files, = parse_argv(argv) files = find_files prompt if files.empty? if (parallel = [:parallel]) prompt_for_each_file_in_parallel prompt, files, parallel else prompt_with_all_files_in_context prompt, files end end |