Sha256: 6da5796a7894a2e485f0846640f592e2933888ee125773c04af359521c5df25c

Contents?: true

Size: 781 Bytes

Versions: 12

Compression:

Stored size: 781 Bytes

Contents

require 'rbbt/util/simpleopt/parse'
require 'rbbt/util/simpleopt/get'
require 'rbbt/util/simpleopt/doc'
module SOPT
  def self.setup(str)
    summary, synopsys, description, options = str.split(/\n\n+/)

    if summary[0]=="-"
      summary, synopsys, description, options = nil, nil, nil, summary
    end

    if synopsys and synopsys[0] != "$"
      description, options = synopsys, description
      synopsys = nil
    end

    if description and description[0] == "-"
      description, options = nil, description
    end

    synopsys.sub!(/^\$\s+/,'') if synopsys

    SOPT.summary = summary.strip if summary
    SOPT.synopsys = synopsys.strip if synopsys
    SOPT.description = description.strip if description
    SOPT.parse options  if options

    SOPT.consume
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rbbt-util-5.8.8 lib/rbbt/util/simpleopt/setup.rb
rbbt-util-5.8.7 lib/rbbt/util/simpleopt/setup.rb
rbbt-util-5.8.6 lib/rbbt/util/simpleopt/setup.rb
rbbt-util-5.8.4 lib/rbbt/util/simpleopt/setup.rb
rbbt-util-5.8.3 lib/rbbt/util/simpleopt/setup.rb
rbbt-util-5.8.2 lib/rbbt/util/simpleopt/setup.rb
rbbt-util-5.8.1 lib/rbbt/util/simpleopt/setup.rb
rbbt-util-5.8.0 lib/rbbt/util/simpleopt/setup.rb
rbbt-util-5.7.0 lib/rbbt/util/simpleopt/setup.rb
rbbt-util-5.6.17 lib/rbbt/util/simpleopt/setup.rb
rbbt-util-5.6.16 lib/rbbt/util/simpleopt/setup.rb
rbbt-util-5.6.15 lib/rbbt/util/simpleopt/setup.rb