Sha256: 964122c090290753c2315f6a4b95d590da257dda4318272805f345d16249b613
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
#!/usr/bin/env ruby require 'optparse' require 'methadone' require 'hl' class App include Methadone::Main include Methadone::CLILogging main do |keyword,*filenames| if options[:regexp] Array(filenames).unshift(keyword) keyword = options[:regexp] end exit_now! 'search term or --regexp/-p required' if keyword.nil? keyword = keyword.dup highlighter = Hl::Highlighter.new(options) puts highlighter.highlight(filenames,keyword) end description "Highlight terms in output without grepping out lines" options[:color] = 'yellow' colors = ['red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'] on("-c COLOR","--color","Color to use for highlighting",colors,"(#{colors.join('|')})") on("--[no-]bright","-b","Use bright colors") on("--[no-]inverse","-n","Inverse highlight") on("--[no-]underline","-u","Underline highlight") on("--regexp PATTERN","-p","Search term as explicit option") on("--[no-]ignore-case","-i","Ignore case in match") arg :search_term, :optional arg :filename, :optional version Hl::VERSION defaults_from_env_var 'HL_OPTS' go! end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hl-1.0.0 | bin/hl |
hl-0.0.1 | bin/hl |