From 6a1a7a05848ef367553c4f9eafcab8f17d248378 Mon Sep 17 00:00:00 2001 From: Sebastian Celis Date: Thu, 1 Mar 2012 09:31:15 -0600 Subject: [PATCH] Improve formats help text by showing all supported formats. --- lib/twine/cli.rb | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/twine/cli.rb b/lib/twine/cli.rb index 8882607..63df42a 100644 --- a/lib/twine/cli.rb +++ b/lib/twine/cli.rb @@ -39,16 +39,13 @@ module Twine opts.on('-t', '--tags TAGS', Array, 'The tag(s) to use for the specified action. Only strings with that tag will be processed.') do |tags| @options[:tags] = tags end - opts.on('-f', '--format FORMAT', 'The file format to read or write (iOS, Android). Additional formatters can be placed in the formats/ directory.') do |format| + formats = [] + Formatters::FORMATTERS.each do |formatter| + formats << formatter::FORMAT_NAME + end + opts.on('-f', '--format FORMAT', "The file format to read or write (#{formats.join(', ')}). Additional formatters can be placed in the formats/ directory.") do |format| lformat = format.downcase - found_format = false - Formatters::FORMATTERS.each do |formatter| - if formatter::FORMAT_NAME == lformat - found_format = true - break - end - end - if !found_format + if !formats.include?(lformat) STDERR.puts "Invalid format: #{format}" end @options[:format] = lformat