Project

General

Profile

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

hammer-cli-csv / lib / hammer_cli_csv / csv.rb @ cea2c1b9

1
require 'hammer_cli'
2
require 'hammer_cli/exit_codes'
3

    
4
module HammerCLICsv
5
  module Help
6
    class Builder < HammerCLI::Help::Builder
7
      def add_list(heading, items)
8
        items.delete_if do |item|
9
          if item.class == Clamp::Subcommand::Definition
10
            !item.subcommand_class.supported?
11
          else
12
            false
13
          end
14
        end
15
        super(heading, items)
16
      end
17
    end
18
  end
19

    
20
  class CsvCommand < HammerCLI::AbstractCommand
21
    def help
22
      self.class.help(invocation_path, HammerCLICsv::Help::Builder.new)
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