1
|
require 'hammer_cli'
|
2
|
require 'hammer_cli/exit_codes'
|
3
|
|
4
|
module HammerCLICsv
|
5
|
class CsvCommand < HammerCLI::AbstractCommand
|
6
|
def help
|
7
|
self.class.help(invocation_path, CsvSortedBuilder.new)
|
8
|
end
|
9
|
|
10
|
class CsvSortedBuilder < SortedBuilder
|
11
|
def add_list(heading, items)
|
12
|
items.delete_if do |item|
|
13
|
if item.class == Clamp::Subcommand::Definition
|
14
|
!item.subcommand_class.supported?
|
15
|
else
|
16
|
false
|
17
|
end
|
18
|
end
|
19
|
super(heading, items)
|
20
|
end
|
21
|
end
|
22
|
end
|
23
|
|
24
|
HammerCLI::MainCommand.subcommand('csv',
|
25
|
_('import to or export from a running foreman server'),
|
26
|
HammerCLICsv::CsvCommand)
|
27
|
end
|