Class: FastlaneCore::CommanderGenerator

Inherits:
Object
  • Object
show all
Includes:
Commander::Methods
Defined in:
lib/fastlane_core/configuration/commander_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate(options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fastlane_core/configuration/commander_generator.rb', line 7

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