Sha256: 20fb0653bfa76c13748c2397948fe9ee1fb554754b1db1eccb5832a5a30b708e

Contents?: true

Size: 767 Bytes

Versions: 4

Compression:

Stored size: 767 Bytes

Contents

require 'commander'

module FastlaneCore
  class CommanderGenerator
    include Commander::Methods

    def generate(options)
      short_codes = []
      options.each do |option|
        appendix = (option.is_string ? "STRING" : "")
        type = (option.is_string ? String : nil)
        short_option = option.short_option || "-#{option.key.to_s[0]}"

        raise "Short option #{short_option} already taken for key #{option.key}".red if short_codes.include?short_option
        raise "-v is already used for the version (key #{option.key})".red if short_option == "-v"
        
        short_codes << short_option
        global_option short_option, "--#{option.key} #{appendix}", type, (option.description + " (#{option.env_name})")
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fastlane_core-0.13.0 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.12.0 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.11.1 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.11.0 lib/fastlane_core/configuration/commander_generator.rb