Sha256: daf68dd8eb85bb028ac9cce9d1223cb98c4834427d862012c190ef505ab17b88

Contents?: true

Size: 1.29 KB

Versions: 24

Compression:

Stored size: 1.29 KB

Contents

require 'commander'

module FastlaneCore
  class CommanderGenerator
    include Commander::Methods

    # Calls the appropriate methods for commander to show the available parameters
    def generate(options)
      # First, enable `always_trace`, to show the stack trace
      always_trace!

      short_codes = []
      options.each do |option|
        appendix = (option.is_string ? "STRING" : "")
        type = (option.is_string ? String : nil)
        short_option = option.short_option

        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"
        raise "-h is already used for the help screen (key #{option.key})".red if short_option == "-h"
        raise "-t is already used for the trace screen (key #{option.key})".red if short_option == "-t"

        short_codes << short_option if short_option

        # Example Call
        # c.option '-p', '--pattern STRING', String, 'Description'

        flag = "--#{option.key} #{appendix}"
        description = option.description
        description += " (#{option.env_name})" if option.env_name.to_s.length > 0

        global_option short_option, flag, type, description
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
fastlane_core-0.28.0 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.27.0 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.26.6 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.26.5 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.26.4 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.26.3 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.26.2 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.26.1 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.26.0 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.25.2 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.25.1 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.25.0 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.24.0 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.23.0 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.22.3 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.22.2 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.22.1 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.21.1 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.21.0 lib/fastlane_core/configuration/commander_generator.rb
fastlane_core-0.20.0 lib/fastlane_core/configuration/commander_generator.rb