Revision c06f1783
Added by Thomas McKay over 6 years ago
lib/hammer_cli_csv/architectures.rb | ||
---|---|---|
6 | 6 |
|
7 | 7 |
OPERATINGSYSTEMS = 'Operating Systems' |
8 | 8 |
|
9 |
def export |
|
10 |
CSV.open(option_file || '/dev/stdout', 'wb', {:force_quotes => true}) do |csv| |
|
11 |
csv << [NAME, OPERATINGSYSTEMS] |
|
12 |
@api.resource(:architectures).call(:index, {:per_page => 999999})['results'].each do |architecture| |
|
13 |
architecture = @api.resource(:architectures).call(:show, {:id => architecture['id']}) |
|
14 |
name = architecture['name'] |
|
15 |
operatingsystems = export_column(architecture, 'operatingsystems', 'title') |
|
16 |
csv << [name, operatingsystems] |
|
17 |
end |
|
9 |
def export(csv) |
|
10 |
csv << [NAME, OPERATINGSYSTEMS] |
|
11 |
@api.resource(:architectures).call(:index, {:per_page => 999999})['results'].each do |architecture| |
|
12 |
architecture = @api.resource(:architectures).call(:show, {:id => architecture['id']}) |
|
13 |
name = architecture['name'] |
|
14 |
operatingsystems = export_column(architecture, 'operatingsystems', 'title') |
|
15 |
csv << [name, operatingsystems] |
|
18 | 16 |
end |
19 | 17 |
end |
20 | 18 |
|
Also available in: Unified diff
fixes #15743 - import and export of subscriptions one-per-line