Sha256: df52a5d4972c84e6068035cda5964c1016b1ec67f4ac97b4bbba12e825cc3fd7
Contents?: true
Size: 891 Bytes
Versions: 4
Compression:
Stored size: 891 Bytes
Contents
module UltraCommandLine module Commands module HelpFormatter DEFAULT_SEPARATOR_WIDTH = 80 DEFAULT_SEPARATOR_FILLER = '-'.freeze DEFAULT_TITLE = 'Options'.freeze attr_writer :separator_width, :separator_filler def separator_width @separator_width ||= DEFAULT_SEPARATOR_WIDTH end def title name.nil? || name.empty? ? DEFAULT_TITLE : name end def separator_filler @separator_filler ||= DEFAULT_SEPARATOR_FILLER end def help output = [] output << banner unless options.empty? output << build_separator(title) output.concat options.map(&:help_line) end output end private def build_separator(title) "#{separator_filler * 2} #{title} ".ljust separator_width, separator_filler end end end end
Version data entries
4 entries across 4 versions & 1 rubygems