Project

General

Profile

Revision cea2c1b9

Added by Andrew Kofink about 5 years ago

Fixes #17307 - move help module out of CsvCommand (#137)

View differences:

lib/hammer_cli_csv/csv.rb
2 2
require 'hammer_cli/exit_codes'
3 3

  
4 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
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
19 13
          end
20
          super(heading, items)
21 14
        end
15
        super(heading, items)
22 16
      end
23 17
    end
24 18
  end
25 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 26
  HammerCLI::MainCommand.subcommand('csv',
27 27
                                    _('import to or export from a running foreman server'),
28 28
                                    HammerCLICsv::CsvCommand)

Also available in: Unified diff