class MarkdownExec::MarkParse
def find_value(value, execute_chosen_found: false)
def find_value(value, execute_chosen_found: false) find_path = @options[:find_path].present? ? @options[:find_path] : @options[:path] @fout.fout 'Searching in: ' \ "#{HashDelegator.new(@options).string_send_color(find_path, :menu_chrome_color)}" searcher = SearchResultsReport.new(value, [find_path]) file_names = searcher.file_names(options, value) file_contents = searcher.file_contents(options, value) directory_names = searcher.directory_names(options, value) ### search in file contents (block names, chrome, or text) [file_contents, directory_names, file_names].each do |data| @fout.fout "In #{data[:section_title]}" if data[:section_title] next unless data[:formatted_text] data[:formatted_text].each do |fi| @fout.fout fi[:header] if fi[:header] @fout.fout fi[:content] if fi[:content] end end return { exit: true } unless execute_chosen_found ## pick a document to open # files = directory_names[:data].map do |dn| find_files('*', [dn], exclude_dirs: true) end.flatten(1) choices = \ [{ disabled: '', name: "in #{file_names[:section_title]}".cyan }] \ + file_names[:data] \ + [{ disabled: '', name: "in #{directory_names[:section_title]}".cyan }] \ + files \ + [{ disabled: '', name: "in #{file_contents[:section_title]}".cyan }] \ + file_contents[:data] @options[:filename] = select_document_if_multiple(choices) { exit: false } end