class Codeowners::Cli::SuggestFileFromPattern
Case the user have `fzf` installed, it works building suggestions from `fzf`. See more on fzf_query.
Without `fzf` it tries to suggest patterns using fuzzy match search picking all the files from the parent folder of the current pattern.
Public Class Methods
installed_fzf?()
click to toggle source
Checks if fzf is installed.
# File lib/codeowners/cli/suggest_file_from_pattern.rb, line 28 def self.installed_fzf? system('fzf --version > /dev/null 2>&1') end
new(pattern)
click to toggle source
# File lib/codeowners/cli/suggest_file_from_pattern.rb, line 11 def initialize(pattern) @pattern = pattern end
Public Instance Methods
pick_suggestion()
click to toggle source
Pick suggestion from current pattern If have fzf installed, pick suggestions using fzf otherwise fallback to the default fuzzy match searching for the file from the parent folder.
# File lib/codeowners/cli/suggest_file_from_pattern.rb, line 19 def pick_suggestion strategy_class.new(@pattern).pick_suggestions end
strategy_class()
click to toggle source
# File lib/codeowners/cli/suggest_file_from_pattern.rb, line 23 def strategy_class SuggestFileFromPattern.installed_fzf? ? FilesFromFZFSearch : FilesFromParentFolder end