lib/tty/reader/completer.rb
def complete_initial(line, direction: :next)
        @word = line.word_to_complete
        suggestions = handler.(word)
        completions.clear

        return if suggestions.empty?

        completions.concat(suggestions)
        completions.previous if direction == :previous
        completed_word = completions.get

        line.remove(word.length)
        line.insert(completed_word + suffix)

        completed_word
      end
# Find suggestions and complete the initial word
#
# @param [Line] line
#   the line to complete a word in
# @param [Symbol] direction
#   the direction in which to cycle through completions
#
# @return [String, nil]
#   the completed word or nil when no suggestion is found
#
# @api public
Find suggestions and complete the initial word
Find suggestions and complete the initial word
def complete_initial(line, direction: :next)
        @word = line.word_to_complete
        suggestions = handler.(word)
        completions.clear
        return if suggestions.empty?
        completions.concat(suggestions)
        completions.previous if direction == :previous
        completed_word = completions.get
        line.remove(word.length)
        line.insert(completed_word + suffix)
        completed_word
      end
def complete_initial ( line , direction : :next ) @word = line . word_to_complete suggestions = handler . ( word ) completions . clear return if suggestions . empty? completions . concat ( suggestions ) completions . previous if direction == :previous completed_word = completions . get line . remove ( word . length ) line . insert ( completed_word + suffix ) completed_word end
Find suggestions and complete the initial word
Find suggestions and complete the initial word
the completed word or nil when no suggestion is found
the completed word or nil when no suggestion is found
String, nil
line
direction
direction the direction in which to cycle through completions
direction the direction in which to cycle through completions
api
None