Class: Rixie::CLI::Commands::Strategy
- Inherits:
-
Base
- Object
- Base
- Rixie::CLI::Commands::Strategy
show all
- Defined in:
- lib/rixie/cli/commands/strategy.rb
Constant Summary
collapse
- STRATEGIES =
{
"simple" => Rixie::Strategy::Simple,
"plan-execute" => Rixie::Strategy::PlanExecute,
"re-act" => Rixie::Strategy::ReAct
}.freeze
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#call(arg, cli:) ⇒ Object
17
18
19
20
21
22
23
24
25
|
# File 'lib/rixie/cli/commands/strategy.rb', line 17
def call(arg, cli:)
if arg && !arg.empty?
set_strategy(arg.strip, cli:)
else
renderer.info("Current", cli.strategy_name)
renderer.heading("Available:")
renderer.list(STRATEGIES.keys, selected: cli.strategy_name)
end
end
|
#complete(input) ⇒ Object
27
28
29
30
|
# File 'lib/rixie/cli/commands/strategy.rb', line 27
def complete(input)
arg = input.delete_prefix("/strategy ")
STRATEGIES.keys.select { |s| s.start_with?(arg) }.map { |s| "/strategy #{s}" }
end
|
#description ⇒ Object
15
|
# File 'lib/rixie/cli/commands/strategy.rb', line 15
def description = "Switch execution strategy"
|
#name ⇒ Object
13
|
# File 'lib/rixie/cli/commands/strategy.rb', line 13
def name = "strategy"
|
#resolve(name) ⇒ Object
32
33
34
|
# File 'lib/rixie/cli/commands/strategy.rb', line 32
def resolve(name)
STRATEGIES[name]&.new
end
|