Sha256: 08edd79040363d9b1a85ad0d7df366a487d1da1e92768c27fb8592c44a5aa3a4
Contents?: true
Size: 479 Bytes
Versions: 6
Compression:
Stored size: 479 Bytes
Contents
require 'markdo/command' module Markdo class QueryCommand < Command def run(string) regexp = Regexp.new(string, Regexp::IGNORECASE) matches = Dir. glob(markdown_glob). map { |path| File.readlines(path, encoding: 'UTF-8') }. flatten. grep(regexp). reject { |line| line.match(/[-*] \[x\]/) } @stdout.puts(matches) end protected def markdown_glob "#{@env['MARKDO_ROOT']}/*.md" end end end
Version data entries
6 entries across 6 versions & 1 rubygems