Project

General

Profile

Download (796 Bytes) Statistics
| Branch: | Tag: | Revision:

hammer-cli-csv / lib / hammer_cli_csv / csv.rb @ 0bd50d7a

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, HammerCLICsv::Help::Builder.new)
8
    end
9

    
10
    module Help
11
      class Builder < HammerCLI::Help::Builder
12
        def add_list(heading, items)
13
          items.delete_if do |item|
14
            if item.class == Clamp::Subcommand::Definition
15
              !item.subcommand_class.supported?
16
            else
17
              false
18
            end
19
          end
20
          super(heading, items)
21
        end
22
      end
23
    end
24
  end
25

    
26
  HammerCLI::MainCommand.subcommand('csv',
27
                                    _('import to or export from a running foreman server'),
28
                                    HammerCLICsv::CsvCommand)
29
end