Class: GLI::Commands::HelpModules::ArgNameFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/gli/commands/help_modules/arg_name_formatter.rb

Overview

Handles wrapping text

Instance Method Summary collapse

Instance Method Details

#format(arguments_description, arguments_options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/gli/commands/help_modules/arg_name_formatter.rb', line 6

def format(arguments_description,arguments_options)
  return '' if String(arguments_description).strip == ''
  desc = arguments_description
  if arguments_options.include? :optional
    desc = "[#{desc}]"
  end
  if arguments_options.include? :multiple
    desc = "#{desc}[, #{desc}]*"
  end
  " " + desc
end