Sha256: 930a253de66183764f557a1f80fda9e8f6edd09630107fab2ea756c5f1de1614

Contents?: true

Size: 986 Bytes

Versions: 2

Compression:

Stored size: 986 Bytes

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'methadone'
require 'hl'

class App
  include Methadone::Main
  include Methadone::CLILogging

  main do
    keyword = options[:regexp] || ARGV.shift

    exit_now! 'search term or --regexp/-p required' if keyword.nil?

    Hl::Highlighter.new(options).highlight(keyword.dup)
  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.2.0 bin/hl
hl-1.1.0 bin/hl