Sha256: c62847166235f0ba7a6b1dac6190e2e3a0682046a394b56aa024608b38324174

Contents?: true

Size: 885 Bytes

Versions: 18

Compression:

Stored size: 885 Bytes

Contents

# encoding: UTF-8

module Kafo
  module HelpBuilders
    class Basic < Base
      def add_module(name, items)
        pruned = except_resets(items)
        pruned = except_advanced(pruned)
        data = by_parameter_groups(pruned)
        add_list(module_header(name), data[DEFAULT_GROUP_NAME])
      end

      def add_list(heading, items)
        pruned = except_advanced(items)
        super(heading, pruned)
      end

      def string
        super + "\nOnly commonly used options have been displayed.\nUse --full-help to view the complete list."
      end

      private

      def except_resets(items)
        items.select { |i| !i.help.first.strip.start_with?('--reset-') || !i.help.last.include?('to the default value (') }
      end

      def except_advanced(items)
        items.reject { |item| item.respond_to?(:advanced?) && item.advanced? }
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
kafo-7.6.0 lib/kafo/help_builders/basic.rb
kafo-7.5.1 lib/kafo/help_builders/basic.rb
kafo-7.5.0 lib/kafo/help_builders/basic.rb
kafo-7.4.0 lib/kafo/help_builders/basic.rb
kafo-7.3.0 lib/kafo/help_builders/basic.rb
kafo-7.2.0 lib/kafo/help_builders/basic.rb
kafo-7.1.0 lib/kafo/help_builders/basic.rb
kafo-7.0.0 lib/kafo/help_builders/basic.rb
kafo-6.5.0 lib/kafo/help_builders/basic.rb
kafo-6.4.1 lib/kafo/help_builders/basic.rb
kafo-6.4.0 lib/kafo/help_builders/basic.rb
kafo-6.3.0 lib/kafo/help_builders/basic.rb
kafo-6.2.1 lib/kafo/help_builders/basic.rb
kafo-6.2.0 lib/kafo/help_builders/basic.rb
kafo-6.1.2 lib/kafo/help_builders/basic.rb
kafo-6.1.1 lib/kafo/help_builders/basic.rb
kafo-6.1.0 lib/kafo/help_builders/basic.rb
kafo-6.0.0 lib/kafo/help_builders/basic.rb