Remove unused processed option element
This commit is contained in:
		
							parent
							
								
									4bbad3c995
								
							
						
					
					
						commit
						7acddd7eb2
					
				@ -11,10 +11,9 @@ module Homebrew
 | 
			
		||||
      # Represents a processed option. The array elements are:
 | 
			
		||||
      #   0: short option name (e.g. "-d")
 | 
			
		||||
      #   1: long option name (e.g. "--debug")
 | 
			
		||||
      #   2: ???
 | 
			
		||||
      #   3: option description (e.g. "Print debugging information")
 | 
			
		||||
      #   4: whether the option is hidden)
 | 
			
		||||
      OptionsType = T.type_alias { T::Array[[String, T.nilable(String), NilClass, String, T::Boolean]] }
 | 
			
		||||
      #   2: option description (e.g. "Print debugging information")
 | 
			
		||||
      #   3: whether the option is hidden
 | 
			
		||||
      OptionsType = T.type_alias { T::Array[[String, T.nilable(String), String, T::Boolean]] }
 | 
			
		||||
      # rubocop:enable Style/MutableConstant
 | 
			
		||||
 | 
			
		||||
      sig { returns(T::Array[String]) }
 | 
			
		||||
 | 
			
		||||
@ -670,7 +670,7 @@ module Homebrew
 | 
			
		||||
      def process_option(*args, type:, hidden: false)
 | 
			
		||||
        option, = @parser.make_switch(args)
 | 
			
		||||
        @processed_options.reject! { |existing| existing.second == option.long.first } if option.long.first.present?
 | 
			
		||||
        @processed_options << [option.short.first, option.long.first, option.arg, option.desc.first, hidden]
 | 
			
		||||
        @processed_options << [option.short.first, option.long.first, option.desc.first, hidden]
 | 
			
		||||
 | 
			
		||||
        args.pop # last argument is the description
 | 
			
		||||
        if type == :switch
 | 
			
		||||
 | 
			
		||||
@ -199,7 +199,7 @@ module Commands
 | 
			
		||||
    return if path.blank?
 | 
			
		||||
 | 
			
		||||
    if (cmd_parser = Homebrew::CLI::Parser.from_cmd_path(path))
 | 
			
		||||
      cmd_parser.processed_options.filter_map do |short, long, _, desc, hidden|
 | 
			
		||||
      cmd_parser.processed_options.filter_map do |short, long, desc, hidden|
 | 
			
		||||
        next if hidden
 | 
			
		||||
 | 
			
		||||
        [long || short, desc]
 | 
			
		||||
 | 
			
		||||
@ -96,9 +96,10 @@ module Homebrew
 | 
			
		||||
      man_page_lines.compact.join("\n")
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    sig { params(cmd_parser: CLI::Parser).returns(T::Array[String]) }
 | 
			
		||||
    def self.cmd_parser_manpage_lines(cmd_parser)
 | 
			
		||||
      lines = [format_usage_banner(cmd_parser.usage_banner_text)]
 | 
			
		||||
      lines += cmd_parser.processed_options.filter_map do |short, long, _, desc, hidden|
 | 
			
		||||
      lines += cmd_parser.processed_options.filter_map do |short, long, desc, hidden|
 | 
			
		||||
        next if hidden
 | 
			
		||||
 | 
			
		||||
        if long.present?
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user