Sha256: 1cffdc2b39a0b3c95645c2df8ad19e1a1433d029764917936e1c996e35de9a38

Contents?: true

Size: 1.42 KB

Versions: 28

Compression:

Stored size: 1.42 KB

Contents

# -*- encoding: UTF-8 -*-
require 'csd/extensions/core/string'
require 'optparse'

module CSD
  module Extensions
    module Core
      # This module comprises extensions to OptionParser objects.
      #
      module OptionParser

        # Inserts a new line to the options help output.
        #
        def newline
          separator ''
        end
          
        # Inserts a new line and a headline to the options help output.
        #
        def headline(text)
          newline
          separator(text)
        end
        
        # Inserts an indented headline to the options help output.
        #
        def subheadline(text)
          separator(@summary_indent + text)
        end
        
        # This method creates a line with two columns. The +item+ will be in the first
        # column and be indented. The +description+ will be in the second column.
        #
        # ==== Examples
        #
        #  OptionParser.new do |opts|
        #    opts.headline 'List of Applications'
        #    opts.list_item 'MiniSIP', 'An open-source high-definition video conferencing client.'
        #    opts.list_item 'OpenSIP', 'An open-source SIP server.'
        # end
        #
        def list_item(item='', description='')
          separator(summary_indent + item.ljust(summary_width + 1) + description)
        end
        
      end
    end
  end
end

class OptionParser #:nodoc:
  include CSD::Extensions::Core::OptionParser
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
csd-0.4.3 lib/csd/extensions/core/option_parser.rb
csd-0.4.2 lib/csd/extensions/core/option_parser.rb
csd-0.4.1 lib/csd/extensions/core/option_parser.rb
csd-0.4.0 lib/csd/extensions/core/option_parser.rb
csd-0.3.7 lib/csd/extensions/core/option_parser.rb
csd-0.3.6 lib/csd/extensions/core/option_parser.rb
csd-0.3.5 lib/csd/extensions/core/option_parser.rb
csd-0.3.4 lib/csd/extensions/core/option_parser.rb
csd-0.3.3 lib/csd/extensions/core/option_parser.rb
csd-0.3.2 lib/csd/extensions/core/option_parser.rb
csd-0.3.1 lib/csd/extensions/core/option_parser.rb
csd-0.3.0 lib/csd/extensions/core/option_parser.rb
csd-0.2.2 lib/csd/extensions/core/option_parser.rb
csd-0.2.1 lib/csd/extensions/core/option_parser.rb
csd-0.2.0 lib/csd/extensions/core/option_parser.rb
csd-0.1.18 lib/csd/extensions/core/option_parser.rb
csd-0.1.17 lib/csd/extensions/core/option_parser.rb
csd-0.1.16 lib/csd/extensions/core/option_parser.rb
csd-0.1.15 lib/csd/extensions/core/option_parser.rb
csd-0.1.14 lib/csd/extensions/core/option_parser.rb