114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
# File 'lib/hammer_cli/options/normalizers.rb', line 114
def description(richtext: true)
'"' + reduce([]) do |schema, nested_param|
name = nested_param.name
name = HighLine.color(name, :bold) if nested_param.required? && richtext
values = nested_param.validator.scan(/<[^>]+>[\w]+<\/?[^>]+>/)
value_pattern = if values.empty?
"<#{nested_param.expected_type.downcase}>"
else
values = values.map do |value|
value.gsub(/(<\/?[^>]+>)*([\.,]*)*/, '')
end
"[#{values.join('|')}]"
end
schema << "#{name}=#{value_pattern}"
end.join('\,').concat(', ... "')
end
|