Class: Ace::Overseer::CLI::Commands::Prompt
- Inherits:
-
Support::Cli::Command
- Object
- Support::Cli::Command
- Ace::Overseer::CLI::Commands::Prompt
- Includes:
- Support::Cli::Base
- Defined in:
- lib/ace/overseer/cli/commands/prompt.rb
Instance Method Summary collapse
- #call(work:, file: nil) ⇒ Object
-
#initialize(client: nil, input: $stdin) ⇒ Prompt
constructor
A new instance of Prompt.
Constructor Details
Instance Method Details
#call(work:, file: nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ace/overseer/cli/commands/prompt.rb', line 16 def call(work:, file: nil, **) if file prompt = File.read(file) else if @input.respond_to?(:tty?) && @input.tty? raise Ace::Support::Cli::Error, "prompt text is required via --file or stdin" end prompt = @input.read end raise Ace::Support::Cli::Error, "prompt text must contain non-whitespace characters" if prompt.strip.empty? puts @client.call("work", "prompt", work, stdin_data: prompt, json: false) rescue => error raise Ace::Support::Cli::Error.new(error.) end |