Class: SchwarmCli::Commands::SkillFilesCmd
- Inherits:
-
Base
- Object
- Thor
- Base
- SchwarmCli::Commands::SkillFilesCmd
show all
- Defined in:
- lib/schwarm_cli/commands/skill_files.rb
Constant Summary
Constants inherited
from Base
Base::DEFAULT_LIST_LIMIT
Instance Method Summary
collapse
Methods inherited from Base
exit_on_failure?, pagination_options
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: options[:skill], path: options[: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: options[: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: options[: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: options[: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: options[:skill], id:, **update_attrs)
output_record(data, fields: { "ID" => "id", "Path" => "path" })
end
end
|