lib/thor/parser/option.rb in josevalim-thor-0.10.20 vs lib/thor/parser/option.rb in josevalim-thor-0.10.21

- old
+ new

@@ -76,19 +76,23 @@ def human_name @human_name ||= dasherized? ? undasherize(name) : name end - def usage + def usage(padding=0) sample = if banner "#{switch_name}=#{banner}" else switch_name end - sample = "[#{sample}]" unless required? - sample = "#{aliases.join(', ')}, #{sample}" unless aliases.empty? - sample + sample = "[#{sample}]" unless required? + + if aliases.empty? + (" " * padding) << sample + else + "#{aliases.join(', ')}, #{sample}" + end end protected def valid_type?(type)