Project

General

Profile

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

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

1 f8ecc788 Tom McKay
require 'hammer_cli'
2
require 'hammer_cli/exit_codes'
3
4
module HammerCLICsv
5 cea2c1b9 Andrew Kofink
  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 b2e88b7c Tom McKay
          end
14
        end
15 cea2c1b9 Andrew Kofink
        super(heading, items)
16 b2e88b7c Tom McKay
      end
17
    end
18 f8ecc788 Tom McKay
  end
19
20 cea2c1b9 Andrew Kofink
  class CsvCommand < HammerCLI::AbstractCommand
21
    def help
22
      self.class.help(invocation_path, HammerCLICsv::Help::Builder.new)
23
    end
24
  end
25
26 26b7d467 Tom McKay
  HammerCLI::MainCommand.subcommand('csv',
27 b2e88b7c Tom McKay
                                    _('import to or export from a running foreman server'),
28 f8ecc788 Tom McKay
                                    HammerCLICsv::CsvCommand)
29
end