Class: RubynCode::CLI::Commands::Skill

Inherits:
Base
  • Object
show all
Defined in:
lib/rubyn_code/cli/commands/skill.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

aliases, all_names, hidden?

Class Method Details

.command_nameObject



7
# File 'lib/rubyn_code/cli/commands/skill.rb', line 7

def self.command_name = '/skill'

.descriptionObject



8
# File 'lib/rubyn_code/cli/commands/skill.rb', line 8

def self.description = 'Load a skill or list available skills'

Instance Method Details

#execute(args, ctx) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rubyn_code/cli/commands/skill.rb', line 10

def execute(args, ctx)
  return list_skills(ctx) if args.empty?

  case args.first
  when 'search' then search_skills(args[1..].join(' '), ctx)
  when 'list'   then list_by_category(args[1], ctx)
  else               load_skill(args.first, ctx)
  end
rescue StandardError => e
  ctx.renderer.error("Skill error: #{e.message}")
end