Class: Kward::Tools::PrepareShellCommand
- Defined in:
- lib/kward/tools/prepare_shell_command.rb
Overview
Prepares a command in the active embedded shell without executing it.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #call(args, _conversation, cancellation: nil) ⇒ Object
-
#initialize(shell_prompt_session:) ⇒ PrepareShellCommand
constructor
A new instance of PrepareShellCommand.
Methods inherited from Base
Constructor Details
#initialize(shell_prompt_session:) ⇒ PrepareShellCommand
Returns a new instance of PrepareShellCommand.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/kward/tools/prepare_shell_command.rb', line 10 def initialize(shell_prompt_session:) @shell_prompt_session = shell_prompt_session super( "prepare_shell_command", "Place a command in the active shell prompt without executing it. The user must press Enter to run it.", properties: { command: { type: "string", description: "Complete shell command to place in the prompt." } }, required: ["command"] ) end |
Instance Method Details
#call(args, _conversation, cancellation: nil) ⇒ Object
22 23 24 25 |
# File 'lib/kward/tools/prepare_shell_command.rb', line 22 def call(args, _conversation, cancellation: nil) cancellation&.raise_if_cancelled! @shell_prompt_session.prepare(argument(args, :command, "")) end |