Class: SchwarmCli::Commands::SkillFilesCmd
- Defined in:
- lib/schwarm_cli/commands/skill_files.rb
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#create ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/schwarm_cli/commands/skill_files.rb', line 33 def create handle_errors do content = read_content data = client.skill_files.create(skill_id: [:skill], path: [:path], content:) output_record(data, fields: { "ID" => "id", "Path" => "path" }) end end |
#delete(id) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/schwarm_cli/commands/skill_files.rb', line 53 def delete(id) handle_errors do client.skill_files.destroy(skill_id: [:skill], id:) puts "Skill file #{id} deleted." end end |
#list ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/schwarm_cli/commands/skill_files.rb', line 10 def list handle_errors do data = fetch_paged do |page_params| client.skill_files.list(skill_id: [:skill], **page_params) end output_list(data, columns: [%w[ID id], %w[PATH path], %w[CREATED created_at]]) end end |
#show(id) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/schwarm_cli/commands/skill_files.rb', line 20 def show(id) handle_errors do data = client.skill_files.find(skill_id: [:skill], id:) output_record(data, fields: { "ID" => "id", "Path" => "path", "Content" => "content", "Created" => "created_at" }) end end |
#update(id) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/schwarm_cli/commands/skill_files.rb', line 45 def update(id) handle_errors do data = client.skill_files.update(skill_id: [:skill], id:, **update_attrs) output_record(data, fields: { "ID" => "id", "Path" => "path" }) end end |