Sha256: bd713ea2d7268aca13ad32f9c19b9fec1d8cf6a8d1c58dfcef54ebf2a1d21578
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
#!/usr/bin/env ruby $LOAD_PATH.unshift(__dir__ + "/../lib") require "harri" require "harri/version" require "filewatcher" require "optparse" class CLI def self.parse_options(args) options = {} option_parser = OptionParser.new do |opts| opts.banner = "Usage: harri -f FILE" opts.separator "" opts.separator "Example:" opts.separator " $ harri -f ghcid.txt" opts.separator "" opts.separator "Options:" opts.on("-v", "--version", "Print the version") do |v| puts "Harri v#{Harri::Version::VERSION}" exit end opts.on_tail("-h", "--help", "Show this message") do puts opts exit end opts.on("-f", "--file FILE", "The file containing GHC errors") do |file| options[:file] = file end end option_parser.parse!(args) options end end ARGV << "-h" if ARGV.empty? && $stdin.tty? cli_options = CLI.parse_options ARGV error_dir = File.expand_path(File.dirname(cli_options[:file])) error_log = File.read cli_options[:file] unused_import_errors = Harri.parse_unused_import_errors_from_log error_log unused_import_errors.each do |import_info| source_location = File.join error_dir, import_info[:file] file_contents = File.read source_location replaced = Harri.remove_unused_imports file_contents, import_info File.write source_location, replaced end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
harri-0.1.0 | exe/harri |