def collect_plugin_name(initial_name = nil)
      plugin_name = initial_name
      first_try = true

      loop do
        if !first_try || plugin_name.to_s.empty?
          plugin_name = @ui.input("What would you like to be the name of your plugin?")
        end
        first_try = false

        unless plugin_name_valid?(plugin_name)
          fixed_name = fix_plugin_name(plugin_name)

          if plugin_name_valid?(fixed_name)
            plugin_name = fixed_name if @ui.confirm("\nWould '#{fixed_name}' be okay to use for your plugin name?")
          end
        end

        break if plugin_name_valid?(plugin_name)

        gem_name = PluginManager.to_gem_name(plugin_name)

        if gem_name_taken?(gem_name)
          # Gem name is already taken on RubyGems
          @ui.message("\nThe gem name '#{gem_name}' is already taken on RubyGems, please choose a different plugin name.")
        else
          # That's a naming error
          @ui.message("\nPlugin names can only contain lower case letters, numbers, and underscores")
          @ui.message("and should not contain 'fastlane' or 'plugin'.")
        end
      end

      plugin_name
    end
def collect_plugin_name(initial_name = nil)
      plugin_name = initial_name
      first_try = true

      loop do
        if !first_try || plugin_name.to_s.empty?
          plugin_name = @ui.input("What would you like to be the name of your plugin?")
        end
        first_try = false

        unless plugin_name_valid?(plugin_name)
          fixed_name = fix_plugin_name(plugin_name)

          if plugin_name_valid?(fixed_name)
            plugin_name = fixed_name if @ui.confirm("\nWould '#{fixed_name}' be okay to use for your plugin name?")
          end
        end

        break if plugin_name_valid?(plugin_name)

        gem_name = PluginManager.to_gem_name(plugin_name)

        if gem_name_taken?(gem_name)
          # Gem name is already taken on RubyGems
          @ui.message("\nThe gem name '#{gem_name}' is already taken on RubyGems, please choose a different plugin name.")
        else
          # That's a naming error
          @ui.message("\nPlugin names can only contain lower case letters, numbers, and underscores")
          @ui.message("and should not contain 'fastlane' or 'plugin'.")
        end
      end

      plugin_name
    end
Plugin name